How to Properly Move WordPress From Subdomain to Root Domain

Do you want to move a WordPress site from subdomain to root domain? The process is fairly easy to follow, and there is a way to save your SEO rankings as well. In this article, we will show you how to easily move WordPress from subdomain to root domain with step by step instructions.

Transferring WordPress from Subdomain to Root Domain

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

Search engines consider subdomain to be a totally different website. This is why you need to make sure that you properly redirect search engines to the root domain after the transfer. This will help you preserve search rankings after moving your website.

UnlikeΒ moving a WordPress site to new hostΒ or aΒ new domain name, moving a site to root domain is a bit easier.

Primarily because both are usually hosted with the same web hosting company. This allows you to skip a few steps.

Let’s take a look at how to move a WordPress site from subdomain to root domain.

Step 1. Create a Complete Backup of Your Website

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

Now if you already have a backup plugin installed, then you may be thinking that you can skip this step.

This step is to remind you that even if you have automated backups of your website, you still need toΒ create a complete backup of your site. This includes a database backup as well as a backup of all your WordPress files and folders.

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

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

First you need to connect to your website using aΒ FTP clientΒ or cPanel’s file manager. Once connected, go to your subfolder location and download all your WordPress files to your computer.

Next, open the public_html folder of your root domain. Depending on how yourΒ WordPress hosting environmentΒ is setup, this folder could also be named www or after your domain name.

Now, you need to upload all WordPress files you downloaded earlier to the root directory.

Step 3. Change WordPress URL and Site URL Settings

Once you move the WordPress files, you will not be able to access the WordPress admin area on the root domain. Trying to login to the root website will send you back to the subdomain website’s admin area.

To fix this, switch to the FTP client and go to the root directory of your domain name. Next, you need to edit the wp-config.php file and add the following lines just before the line β€˜That’s all, stop editing! Happy blogging’.

Don’t forget to replace example.com with your own domain name. If you want your root website to use www then you will need to enter the URLs with www prefix.

Save your changes and upload the wp-config.php file back to your website.

You can now visit your WordPress site’s admin area on the root domain name.

Step 4. Update URLs

Your WordPress site has moved to the root domain, but there will be links inside your WordPress database pointing to the subdomain.

Let’s fix that.

You will need to install and activate theΒ Velvet Blues Update URLsΒ plugin. For more details, see our step by step guide onΒ how to install a WordPress plugin.

Upon activation, you need to visitΒ Tools Β» Update URLsΒ page.

On this page, you need to enter your subdomain url next to the Old URL option and add your root domain as the new URL. Next, under the β€˜Choose which URLs should be updated’ area, you need to check all options except β€˜All GUIDs’.

Once you are done, click on the β€˜Update URLs Now’ button to continue.

The plugin will now update all URLs in your WordPress database. This may take some time. Once finished, you will see a success message.

Step 5. Redirect All Subdomain Traffic to The Root Domain

Now that you have moved WordPress files, let’s make sure that your subdomain traffic is redirected to the root domain name.

Go to your subdomain folder and make sure that hidden files are forced to be visible.

Your FTP client settings have an option to always show hidden files. In FileZilla, it is located under β€˜Server > Force Showing Hidden Files’ option.

If you are using cPanel File Manager, then click on the Settings button at the top right corner of the screen. This will bring up the preferences popup. You need to select β€˜Show hidden files’ and then click on the save button.

If your subdomain folder already has aΒ . file, then you can delete it and create a new one. Inside the newΒ  file, you need to copy and paste the following code:

Don’t forget to replace yoursubdomain with your actual subdomain, and example.com with your domain name.

Please note that the RewriteRule line uses aΒ non-www URL. If you want to use www in your root domain, then you will need to add your URL with a www prefix.

Save your changes and upload yourΒ  file to the server.

That’s all, you have successfully moved your site from subdomain to root domain. You can now visit your website to see it in action. Test out your website to make sure that everything is working fine.

We hope this article helped you move your site from subdomain to root domain. You may also want to see our ultimateΒ WordPress SEO guideΒ for beginners.

If you liked this article, then please subscribe to ourΒ YouTube ChannelΒ for WordPress video tutorials. You can also find us onΒ TwitterΒ andΒ Facebook.

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!

Pin It on Pinterest

Add address