How to Move a WordPress Site from a Subdomain to the Root Domain

You are here:
Estimated reading time: 1 min
  • Archive or backup the content of the subdomainBackup the database from phpmyadmin
  • Create a database and import database backup taken (For websites in separate web hosting accounts)Move or upload files to the main domain root
  • Edit wp-config.php to match database credentials
  • Go-to phpmyadmin of the databaseOpen wp_options table

    Replace the values of URL for site_URL and home_URL records to match your new domain name e.g https://newwebsite.com

Some permalinks on your website may not work properly after the migration. To fix broken permalinks, we have to make some changes:

  1. Log in to the WordPress admin panel of your root domain.
  2. Go to Settings > Permalinks and click on Save Changes. This updates the .htaccess file that controls the permalinks on your site. Any broken permalinks should now be fixed.

Now, the internal links on your website may still point to the old domain, i.e., your subdomain. The best way to fix internal links so that they point to the correct domain name, i.e., the root domain, is to use the Go Live Update URLs plugin. Here are the steps:

  1. Install and activate the plugin on your root domain.
  2. Go to Tools > Go Live from your WordPress admin dashboard.
  1. On the next screen, enter your old and new URLs in their respective fields. The plugin will update all instances of the old URLs in the checked databases. Uncheck any databases that you don’t want to get updated.
  1. Click on Update Urls to finish.

If you followed the guide, you have successfully moved your WordPress website from your subdomain to your main domain. This method can also be used to move WordPress websites from your main domain to your subdomain as well can be used to clone your WordPress website to a new domain name.

Was this article helpful?
Dislike 0

Author

Joshua

Web Hosting Geek Technical Support Staff G Online Sites