How to Properly Move WordPress From Subdomain to Root Domain

How to Move WordPress from a Subdomain to the Root Domain (Detailed Guide)

Are you considering moving your WordPress site from a subdomain to the root domain? There are several potential benefits to doing so, including improved SEO, better branding, and a simpler, more professional URL structure.

In this comprehensive guide, we‘ll walk you through the process of migrating WordPress from a subdomain to the root domain step-by-step. We‘ll also discuss some of the key considerations and potential issues to be aware of.

But first, let‘s examine the differences between subdomains and root domains and the SEO implications of each.

Subdomains vs. Root Domains
A subdomain is essentially a separate section of your website that exists on the same domain. It appears before the root domain in the URL, like this:

subdomain.yourdomain.com

Some common reasons to use a subdomain for a WordPress site include:

  • Creating a separate blog or content section (blog.yourdomain.com)
  • Building a store or ecommerce site (store.yourdomain.com)
  • Developing a mobile version of the site (m.yourdomain.com)

However, many SEO experts argue that it‘s better to keep your content on the root domain (or in subfolders of the root domain) whenever possible. Here‘s why:

  1. Subdomains are treated as separate sites
    From a technical SEO perspective, Google treats subdomains as separate websites. This means the subdomain won‘t inherently benefit from the backlinks, domain authority, and other positive ranking signals associated with the root domain.

As Google‘s John Mueller has confirmed, "Google Web Search is fine with using either subdomains or subdirectories…use what works best for your setup & submit it normally with Search Console." (Source)

  1. Redirecting or migrating from a subdomain is tricky
    Once content has been published on a subdomain and indexed by Google, moving that subdomain to a different URL carries a risk of losing SEO value through the migration. 301 redirects can help, but some link equity is typically lost in the process.

  2. Subdomains can be confusing for users
    Using subdomains can make your site structure appear more complex and potentially confuse visitors. A simpler URL structure based on the root domain tends to be more intuitive and easier to remember.

All that said, there are some situations where a subdomain might make sense from a technical perspective – for instance, to host a high-traffic WordPress blog on separate servers from the main website.

For most WordPress sites, though, the root domain will be preferable for SEO and usability. If your site currently lives on a subdomain, it may be worth considering a migration to the root domain instead.

Of course, this type of migration is a significant undertaking from a technical perspective. You‘ll need to carefully plan out the process and take precautions to avoid SEO issues or downtime.

Let‘s take a look at how to pull off a successful subdomain-to-root migration of your WordPress site:

Step 1: Preparation & Planning
Before you start the actual migration process, it‘s critical to get organized and put together a clear plan. Here are some key considerations and action items for the planning stage:

Back up everything
Conducting a full backup of your WordPress site files and database is an absolute must before attempting any kind of migration. Use a plugin like UpdraftPlus or BackWPup to create a complete backup and download it to your computer and/or an external storage service for safekeeping.

Benchmark your "before" metrics
Take screenshots of your current search rankings, organic traffic levels, and top SEO landing pages before the migration. Check Google Search Console for any crawl errors or manual actions that will need to be resolved.

Map out URL redirects
Compile a list of your most important subdomain pages and posts and map out where each one will redirect to on the new site. Generally speaking, you‘ll want to set up 301 (permanent) redirects from the old subdomain URLs to the corresponding new root domain URLs.

Choose a migration window
Decide on a time frame for completing the migration when you anticipate the lowest traffic and business impact. Avoid scheduling the migration immediately before a known seasonal traffic spike – e.g. Black Friday for ecommerce sites.

Notify stakeholders
Give your team, important clients, and other stakeholders advance notice of the migration plan and how it will impact them. Consider sending an email blast to customers or putting up a sitewide banner alerting them to upcoming changes.

With the prep work out of the way, you‘re ready to dive into the actual migration steps:

Step 2: Set Up a Duplicated Site on the Root Domain
The first hands-on step is to set up a copy of your existing WordPress site on the intended root domain. Here‘s how:

  1. In your hosting control panel (e.g. cPanel), create a new database and database user for the migrated WordPress site.

  2. Download the latest version of WordPress and upload it to the root folder of your site via FTP. This is typically a folder called "public_html" or "www".

  3. Create a new wp-config.php file in the root directory or update the existing one with the new database name and credentials established in step 1.

  4. Access the new WordPress site files via FTP and navigate to the wp-content folder. Download the plugins and themes folders to your computer.

  5. Access your existing subdomain WordPress site via FTP, navigate to wp-content, and upload the plugins and themes folders to overwrite the default folders. This will ensure all your existing plugins and theme files are present on the new site.

Your cloned WordPress site should now be up and running on the root domain, with the same plugins and theme as the original subdomain site. But you still need to import the actual content.

Step 3: Migrate Your Content to the Root Domain
The next step is to migrate all your posts, pages, images, categories, tags, and other content from the subdomain site to the new root domain site. An automated migration plugin like Duplicator is the easiest way to handle this:

  1. Install and activate the free Duplicator plugin on your original subdomain WordPress site.

  2. Go to Duplicator > Packages and click the "Create New" button, then click "Next."

  3. Leave the default options selected under "Setup" and continue to the next step.

  4. Under "Scan," make sure there are no issues detected, then click "Build" to create the package.

  5. Once the package is complete, you‘ll see download links for the Installer and the Archive package files. Download both files to your computer.

  6. Access your new WordPress site on the root domain and delete the existing wp-config.php file.

  7. Upload the Installer and Archive files you downloaded in step 5 to the root directory via FTP.

  8. Navigate to http://yourdomain.com/installer.php in your web browser to run the Duplicator installer.

  9. Follow the steps to validate the archive file, then click to Run Deployment.

  10. Verify the details of the new site and database connection on the next step, then click "Run Update."

  11. If all goes well, you should see a success message indicating the migration is complete. Click the Admin Login link to access your newly migrated WordPress site.

Troubleshooting tip: If you encounter errors during the Duplicator migration process, the most common culprit is an inadequate amount of PHP memory on the destination server. Contact your web host for assistance increasing the memory limit.

Step 4: Update URLs & Links
After migrating your WordPress site to the root domain, it‘s likely that some internal links and image sources are still pointing to the old subdomain URLs.

To update all instances of the subdomain URL to the new root domain URL in your WordPress database, you can use a plugin like Better Search Replace:

  1. Install and activate the free Better Search Replace plugin on your migrated WordPress site.

  2. Navigate to Tools > Better Search Replace.

  3. Under "Search for," enter your subdomain URL (e.g. http://subdomain.yourdomain.com).

  4. Under "Replace with," enter your new root domain URL (e.g. http://yourdomain.com).

  5. Leave the other options at their defaults and click "Run Search/Replace."

  6. If the test run looks good, return to the previous screen and check the box to "Run as dry run" before clicking "Run Search/Replace" again.

Repeat this find-and-replace process for any other problematic URLs you encounter, such as old links to /wp-content/uploads or /xmlrpc.php.

Step 5: Set Up 301 Redirects
Once you‘ve updated the internal links, it‘s time to set up permanent redirects from the old subdomain URLs to the new root domain URLs. Doing so will help retain your SEO value and prevent visitors from encountering broken links.

The simplest method is to use the Redirection plugin:

  1. Install and activate the free Redirection plugin on your migrated WordPress site.

  2. Go to Tools > Redirection, then navigate to the "Redirects" tab.

  3. Select "Regex" as the Source URL option.

  4. Under "Source URL," enter the following code:

^/subdomain.yourdomain.com/(.*)$

  1. Under "Target URL," enter /$1

  2. Select "Regex" under "Match" and choose the "301 – Permanent" HTTP code.

  3. Add a description like "Subdomain to root redirect" and click Add Redirect.

Alternatively, you can set up 301 redirects at the server level by editing your site‘s .htaccess file:

  1. Access your WordPress site via FTP and download the .htaccess file to edit it locally.

  2. Add the following code to the top of the file, replacing "subdomain" and "yourdomain" with your own details:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain.yourdomain.com$
RewriteRule ^(.*)$ "http://yourdomain.com/$1" [R=301,L]

  1. Save the changes and re-upload the .htaccess file to your server.

Step 6: Post-Migration Steps
Congratulations – if you‘ve made it this far, the bulk of the migration work is complete! There are just a few final housekeeping items to take care of:

Submit change of address in Google Search Console
If you were previously using Google Search Console to monitor your subdomain property, you‘ll need to add and verify the root domain as a new property. Then submit a change of address request to inform Google that your site has moved.

Update Google Analytics & other tracking scripts
If you‘re using Google Analytics, you‘ll need to update the tracking code snippet on your new site to ensure data continues to flow properly. Do the same for any other tracking scripts or pixels.

Monitor & troubleshoot
Keep a close eye on your site for the first 24-48 hours after the migration to watch for any unexpected issues or errors. It‘s a good idea to perform a final round of quality assurance testing on your most important pages and core functionality.

Track your progress
Remember those "before" screenshots and benchmarks you captured way back in step 1? Now it‘s time to update those metrics and see how your migrated site stacks up. While you should expect some ranking fluctuations in the short term, the site should stabilize and hopefully start seeing SEO improvements within a few weeks.

Common Questions & Concerns
Still have questions or concerns about migrating WordPress from a subdomain to the root domain? Let‘s address a few common ones:

What happens to my old subdomain site after the migration?
It‘s a good idea to keep your old subdomain site in place with the 301 redirects active for at least 3-6 months after the migration. This gives search engines ample time to discover the redirects and attribute authority to your new site. After that, you can safely delete the subdomain site.

Will I lose SEO rankings by migrating my site?
It‘s normal to experience some fluctuations in search rankings immediately following any kind of site move. However, as long as you follow SEO best practices like setting up proper 301 redirects and updating your internal links, your rankings should return and improve over time as search engines process the change.

How can I test the migration before making the switch?
Consider setting up a duplicate instance of your subdomain site on a test domain or local development environment to practice the migration process before attempting it on your live site. This will help you work out any potential kinks and ensure you‘re comfortable with the steps before the real deal.

My site is on a subdomain because I use a separate domain for my main site…what should I do?
In this case, you‘ll need to weigh the SEO benefits of moving to the root domain against the branding implications. It may be worth keeping the subdomain if it aligns better with your brand strategy. Consult with an experienced SEO professional to determine the best path forward.

Wrapping Up

Migrating a WordPress site from a subdomain to the root domain is a complex process with a lot of steps and potential pitfalls. But for most sites, it‘s well worth the effort for the SEO benefits and improved user experience.

By carefully planning the migration, using the right tools, and monitoring the results afterward, you can minimize the risks and pull off a successful subdomain-to-root move. We hope this in-depth guide has given you the knowledge and confidence you need to get the job done right.

Did you like this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.