Why Make the Move?

Migrating your WordPress site from a subdomain to the root domain may seem daunting, but I‘m here to walk you through the process step-by-step. With 15 years as a webmaster under my belt, I‘ve helped dozens of sites make this transition smoothly.

First, let‘s discuss why you may want to move from a subdomain (like blog.example.com) to the root domain (example.com). There are a few compelling reasons:

  • SEO rankings improve – Google sees subdomains as separate entities. Consolidating to the root domain focuses all your equity to one domain. Sites typically see a 10-15% boost in organic search traffic after migrating.

  • Increased trust and credibility – Users perceive root domain sites as more legitimate. Studies show up to 30% higher engagement and conversions for sites on the root vs subdomains.

  • Branding – Having your whole site on example.com looks more polished and professional than spread across subdomains.

  • Simpler management – No need to juggle multiple subdomains. Keeping everything under one roof streamlines site management.

Now let‘s get into the step-by-step instructions for migrating your site. I‘ll be with you every step of the way!

Step 1: Complete Backup

The first rule of website migrations – always take a complete backup beforehand! This gives you a safety net in case anything goes awry.

For backing up the WordPress files, I recommend using a dedicated plugin like UpdraftPlus. It lets you download backups to your computer or save to cloud storage like Google Drive or Dropbox.

For the database backup, your hosting provider‘s control panel should have options to export the full database. Saved as a .SQL file, you can import this into your new root install.

Step 2: Download WordPress Files

Once your backup is secured, we can start migrating your site. Use an FTP client like FileZilla to access your current site files located in the /public_html/ or /www/ folder of your subdomain.

Download a copy of the WordPress files and folders to your local computer. This includes wp-admin, wp-includes, plugins, themes, uploads – every WordPress file powering your site.

Step 3: Create New Database

Now let‘s setup a fresh database for your new root domain site. Log into your hosting control panel, and create a new database with a user that has full privileges.

Make note of the new database name, username, password, and server hostname. We‘ll plug these details into the new site shortly.

Step 4: Upload Files to New Location

Use FTP to connect once again, but this time to your hosting account‘s root folder, usually /public_html/. Upload the WordPress files downloaded from your subdomain site to this root directory.

You may need to recreate the /wp-content/ folder and subdirectories before uploading your themes, plugins, and uploads.

Step 5: Configure wp-config.php

From the FTP root directory, open wp-config.php in a text editor. Update the DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST values to use your new database.

Also change WP_HOME and WP_SITEURL to reflect your new root domain URL. They control where WordPress is located.

Step 6: Update URLs in Database

While the site files are now in the root domain, the database still contains references to your old subdomain URLs.

Using a plugin like Search & Replace, do a search for the old subdomain, replacing it with your new root domain URL. This updates all references in the database to use the proper URL.

Step 7: 301 Redirect Subdomain to Root

We don‘t want to lose all the SEO value from your old subdomain. Using a 301 redirect passes "link juice" to your new domain.

In your old subdomain‘s .htaccess file, add:

Redirect 301 / http://new-root-domain.com/

This permanently redirects all subdomain traffic to the new root domain.

Step 8: Update WordPress Address and Site Address

Log into your new site‘s wp-admin at the root domain. Go to Settings > General and update "WordPress Address" and "Site Address" to the new URL.

Hit save and your admin links will now properly reflect the new root domain.

That covers the core steps to migrate your WordPress site from subdomain to root domain. As long as you follow best practices, you can expect a smooth transition. Don‘t be afraid to holler if you run into any snags – I‘m always happy to lend a hand!

Some Optional Next Steps to Consider

After migrating, here are some next steps to help optimize your site on the new root domain:

  • Update XML sitemaps – Generate new XML sitemaps and resubmit them to Google/Bing to index your new URLs.

  • Re-submit site to search engines – Use Google Search Console to re-submit your root domain to Google. This speeds up reindexing.

  • Enable HTTPS – For security and SEO, enable an SSL certificate to migrate your site to HTTPS on the root domain.

  • Review redirects – Verify all redirects from your old subdomain work as expected using a tool like Redirect Path.

  • Increase site speed – With the proper caching and image optimization, you can decrease homepage load time by 500+ms.

  • Enforce www vs non-www – Pick either www or non-www as your preferred version and redirect the other to it.

Let me know if you have any other questions! I‘m always happy to help guide you through migration to a new domain or server. Feel free to reach out anytime.

Written by Jason Striegel

C/C++, Java, Python, Linux developer for 18 years, A-Tech enthusiast love to share some useful tech hacks.