How to move your WordPress site from Subdomain to Main Domain

Do you want to move a WordPress site from a subdomain to your root domain? The process is fairly easy to follow and we will show you how to easily move WordPress from subdomain to root the domain with step by step instructions.

Backup Your Files

Before beginning, be sure to create a full backup of your entire site. Once you have created a complete backup, make sure that you store it on a remote location or on your local computer.

Moving Your WordPress Files From Subdomain to Root Folder

To start, connect to your website using an 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 set up, 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.

Change the 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’.

1

2

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

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

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.

Update URLs

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

Fix the links

You will need to install and activate the Velvet Blues Update URLs plugin. Or a similar plugin with the same concept.

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

Update URLs

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.

Test Your Site

Test out your website to make sure that everything is working fine. Be sure to go thru all pages and any links you have to ensure it is working proper