How to Move WordPress Site From Subdomain to Root Domain?

Do you wish to Move WordPress site from subdomain to root domain? So users don’t worry. The process is very simple to follow, and there is a right way to save your SEO rankings. So read the whole article carefully as we have shown the complete steps to move WordPress from subdomain to Root Domain.

Move WordPress from Subdomain to Root Domain

A subdomain is an extension of the root domain name. For example, http://yourwebsite.example.com is a subdomain of example.com. In the above case, example.com is the root domain.

Search engines see subdomain to be the different website. This is why you need to make sure that you perfectly redirect search engines to the root domain after the transfer.

Let’s take a look at:

How to migrate a WordPress site from subdomain to root domain.

Step 1. Create a Full Backup of Your Website

You should always conduct a backup solution installed on your website for automated backups. There are many WordPress backup plugins that you can use to keep your WordPress content safe.

if you already have a backup plugin installed, then you might imagine that you can skip this step. Also, this step is to remember you that even if you have automated backup WordPress website, and you still need to create a complete backup WordPress site. This involves a database backup and backup of all your WordPress files and folders.

After you have created a complete backup, make sure that you store it in a remote location or on your computer.

Read Also: 4 simple way to backup your WordPress site

Step 2. Migrating Your WordPress Files From Subdomain to Root Folder

  • Firstly connect to your website using an FTP client or via cPanel’s file manager. After you got connected, just go to your subfolder location and download your whole WordPress files to your computer.

wpfiles

  • After that open the public_html folder of your root domain. Relying on how your WordPress hosting environment is set up, this folder can be named www or after your domain name.
  • Upload whole WordPress files you downloaded earlier to the root directory.

uploadwpfiles

Step 3. Change Settings of WordPress URL and Site URL

After migrating the WordPress files, you will not be capable to access the WordPress admin area on the root domain. When you try to login the root website will send you back to the subdomain website’s admin area. For fixing this:

  • Switch to the FTP client and go to the root directory of your domain name.
  • Edit the wp-config.php file and add the below-given lines just before the line

                     define(‘WP_HOME’,’http://example.com’);

                     define(‘WP_SITEURL’,’http://example.com‘);

  • Don’t miss to replace example.com with your own domain name. If you want your root website to take www then enter the URLs with www prefix.
  • Lastly, save your all changes and upload the wp-config.php file back to your website. You can now easily visit your WordPress site’s admin area on the root domain name.

Step 4. Update URLs

However, your WordPress site has transferred to the root domain, but there will be links inside your WordPress database indicating to the subdomain.

For fixing this.

updateurls

  • On this page, just enter your subdomain URL which is next to the Old URL option and add your root domain to the new URL. Inside the ‘Choose which URLs should be updated’ area, check all options except ‘All GUIDs’.
  • Also, click on the ‘Update URLs Now’ button to continue once you are done. The plugin will now update all URLs in your WordPress database. After the completion, you will see a success message.

Step 5. Redirect All Subdomain Traffic to The Root Domain Name

Check that all subdomain traffic is redirected to the root domain name.

  • First of all, go to your subdomain folder and check that hidden files are enforced to be visible.
  • However, your FTP client settings have an option to always show hidden files and in FileZilla, it is presented under ‘Server > Force Showing Hidden Files’ option.

Move WordPress from Subdomain to Root

  • In case you are using cPanel File Manager, click on the Settings button at the top right corner of the screen. This will show up the preferences popup.
  • Select ‘Show hidden files’ and then click on the save button. In case your subdomain folder previously has a .htaccess file, you can delete it and create a new one. Inside the new .htaccess file, copy and paste the below-given code:
1 <IfModule mod_rewrite.c>

2 RewriteEngine On

3 RewriteBase /

4 RewriteCond %{HTTP_HOST} ^yoursubdomain\.example\.com$ [NC]

5 RewriteRule ^(.*)$ “http://example.com/$1” [R=301,L]

6 </IfModule>

  • The RewriteRule line uses a non-www URL. If you want to take www in your root domain, then add your URL with a www prefix. Just replace your subdomain with your actual subdomain and example.com with your domain name.
  • Save your all changes and upload your .htaccess file to the server.

Now you have successfully transferred your site from the subdomain to root domain. You can also visit your website to see it in action. Check out your website to make sure that everything is working good.

WRAPPING UP

So, by following the above five steps you can easily migrate your WordPress from subdomain to Root Domain. We hope that the above article helped you to move WordPress from subdomain to Root Domain successfully.

You can also talk to our WordPress Technical Support Team in case of any difficulty related to WordPress, Dial + 1 844 275 0975 (Toll-Free). We will solve all your issues related to WordPress so feel free to contact.

Read More:



Leave a Reply

Call Now