As many people have had to move homes (for whatever reasons), sometimes websites also have to move their "home", which is their domain address. But when you transfer a website to a new domain you should also pay attention to something that has no counterpart in our home-moves: SEO rankings.

When you need to move your WordPress website to a new domain address, it's not just a matter of copy-pasting some file to a new "home". It's a matter of making this process as smooth as possible and doing all you need to lower any loss within your SEO rankings that you gained with your old domain.

But how is this possible? What should you take into account to properly move your WordPress website to a new domain and prevent it from losing its SEO rankings?

I'll get through all of these points, but first, let's start with a key clarification: what's a domain name? Roughly said: what you usually type on your browser bar is a website's domain name.

For example, codeable.io is a domain name, google.com is another domain, facebook.com another one. Domain names have been introduced to help users better remember a page's unique IP address, which is made up of numbers.

I bet you'd remember codeable.io way more easily than 104.131.27.111, which resolves into reaching the same page.

So, why would anyone want to move a WordPress website to a new domain?

Changing domain isn't something that the majority of business owners have to face during their life, yet it's still something that happens very often. The most common reasons behind this huge change are these:

  1. Businesses need to rebrand themselves, where their new domain name will be part of this rebranding process
  2. When a better domain becomes available which better represents your business in its niche
  3. When a given domain you own has reached a penalty score that tremendously affects your rankings, i.e. search engines think your content is spam

The tips in this guide will cover examples and scenarios falling under the first two of this list. Even if the following tips would be 100% applicable to scenarios as #3 entails, dealing with penalized domains is a more critical task that must assess and treat each situation as different from the others.

Before you start transferring your website to a new domain

If you're about to, or just thinking about moving your current website to a new domain, you need to consider the switch will involve some temporary loss both on your rankings and search traffic numbers. Please don't freak out, and read it again: it's a temporary loss. This happens (and has happened) to all websites that have been transferred to a new domain, and with the following tips, you'll be able to reduce your loss to its greatest extent.

Let's dig in, then.

Need someone who could take care of moving your website to a new domain? Post your project and have one of our 250+ vetted WordPress experts help you out immediately!

Download your database and your /wp-content/ folder

Your WordPress website is mainly a compound creature made of two types of elements: your database, which stores all your written content such as pages and posts, and static files, such as WordPress core files, your theme files, CSS stylesheets, and images.

When you want to move your current website from olddomain.com to newdomain.com, the very first thing you have to do is to make a copy of your database and static files. These would come in handy if anything went wrong during the transfer process.

There are several ways you could perform a backup of your database:

Once you take care of your database, you'd want to make a copy of all your images, media files, theme, and plugins. If you haven't changed the standard path with some custom settings, these elements are stored within the /wp-content/ folder. There are some exceptions, though: some plugins might store some elements outside of the /wp-content/ folder, usually in the root folder of your website (one level up). Have a look there and if any names of files or folders correspond to any of your plugins then take those too.

To make a copy of your /wp-content/ folder and everything in it, you could use a plugin or just connect via FTP (better SFTP) and download that folder locally to your computer.

Now that you have both elements from your olddomain.com, let's move to newdomain.com.

Upload your database and your files to the new domain

Once you're done with downloading your database and your /wp-content/ folder, it's time to do the actual switch and move all of your files to your new domain. In order to do that, you might need to understand that each hosting company would provide you with different options to make the process easier, one of which is one-click installs of WordPress. So what you'd need to do right at this stage might be different from what others are specifically required to do.

Specifically, if you are using a one-click installer and you see the option "Discourage search engines from crawling your site" you should select yes for this option on the new domain, as it will prevent duplicate content while you make the switch.

Yet, no matter what your hosting provider allows you to do, you'd want to be sure to:

  • Have a new and clean install of WordPress running on newdomain.com - if your hosting doesn't provide it as a one-click install, you can download the latest WordPress version from here.
  • Have your current database (the one from the old domain) restored - when moving to a new domain name, choose the database you'll be importing data into in your phpMyAdmin then click "Import" and select your desired database.
  • Have your old /wp-content/ folder uploaded to newdomain.com - you can do this via a plugin, your cPanel or manually by uploading your folder into the root of your new domain (or a specific directory).

Once the transfer is completed, you'll need to focus on setting up your WordPress install the way you want it. This means checking your menus, widgets and all other custom settings and options that require your action.

If you selected "Discourage search engines from crawling your site" during the move, then you can now reverse this within your WordPress settings.

As an interesting plugin that could help you backing up your website and move it from one domain to another (or from your local computer to a server), I should mention Duplicator which makes things really easy.

Now it's time to work on what might affect your SEO rankings, so let's put on our best goggles and start by looking for broken links.

Search and replace your domain name

Since you uploaded all your files and database into your new domain name, you might encounter 404 pages and broken links. That's why at this stage of your transitioning you should replace all your old URLs with your new URLs. The easiest (and safest for non-technical WordPress users) way is to use a plugin such as Search and Replace or Velvet Blues Update URLs.

For more advanced users, there's a PHP based tool that could be less problematic. To use it, upload it via FTP and start working on it to replace your domain name. Just be sure to remove it from the server once you're done, or you might expose your website to vulnerabilities.

This action will update your database so if you mess it up, you won't be happy. So please check to have a recent backup saved somewhere, and double or even triple check your spelling when writing down your old domain and new domain names. In addition, you should also pay attention of www vs non-www when performing this step. If you don't feel confident about doing it by yourself, you might want it to be handled by a WordPress professional.

Create 301 redirects on your old domain name

How would you tell visitors who land on your olddomain.com that you've moved your website to newdomain.com? To do that properly, you'd need to use 301 redirects which signal to both users and search engines that a given link has moved permanently to a new location. In Moz' words:

A redirect is a way to send both users and search engines to a different URL from the one they originally requested.

But that's not the only benefit of using 301 redirects. In fact, these permanent redirects are those that pass along the most SEO juice. See what Matt Cutts tells about 301 redirects and SEO:

So how can you do that?

Go to your old domain and open the .htaccess file in a text editor (quick memo: the .htaccess file is invisible). Now, if you want to redirect all of your link, i.e. not just your homepage, but every individual blog post and page too, add the following lines to it:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

If you've changed your website structure on your newdomain.com, even just moderately, you might need to manually redirect each page to lower your chances of getting 404 pages on your olddomain.com. If that's your case, you'd need to add each old URL that you want to be redirected and the page URL you want it to be redirected to in your .htaccess file:

Redirect 301 /olddomain.com/page http://www.newdomain.com/page

To be sure the redirects are properly set up and working, you could either use the Fetch as Google feature within the Google Console or just browse through them manually.

The .htaccess can break your website, so please make a copy of it before doing any edits and keep it handy.

Submit an address change of your website in Google Console

Google provides you with a nice tool when it comes to letting it know you've changed your website's address. By using it, you'll tell Google one of your sites has a new home, thus you'll lower any possible harm to your current rankings.

To use the "Change of Address" tool, head over to Google Console, click on your website, i.e. your olddomain.com and then the gear icon in the top right area to find the "Change of Address" option:

Change address tool inside Google console

There are going to be 4 steps involved here to correctly notify Google about the address change. Just follow them.

Create a new XML sitemap and submit it to Google

Once you've told Google about your website's new home, you should then provide the search engine with a fresh list of contents and pages you want to be indexed. To do that, you might want to create a new XML sitemap for your newdomain.com. It will take you a couple of minutes only, thanks to a plugin such as Google XML Sitemaps or Yoast SEO.

As your new XML sitemap is generated, you'd get a specific URL for it. So copy it to your clipboard and get back to the Google Console, and navigate to Crawl > Sitemaps in the left sidebar. From that page, click on the top right red button to submit your new XML sitemap.

Submit a new XML sitemap to Google

We're almost there, so hang on a little longer :)

Add your newdomain.com website to Google Analytics (and paste the new tracking code in)

As you're taking care of all the things that might have an impact on your SEO when you transfer your website to a new domain, you should take care of the last piece of the puzzle: add your website as a new property to your Google Analytics account and get a new tracking code.

The process here is pretty straightforward, so you'd want to:

  • Log into Google Analytics and click the "Admin" tab
  • Click on the "Create a new property" option
  • Add newdomain.com in the "Web Site URL" field
  • Pick your preferred settings for "Industry Category" and "Reporting Time Zone"
  • Click the blue button at the bottom "Get Tracking ID"

Now with your new tracking code, it's just a matter to add it to your website. Easy, right?

"But what does this have to do directly with SEO?", somebody might ask.

Well, tracking visitors doesn't have any direct effect on SEO, yet it provides lots of useful information you could leverage for SEO purposes.

What I'd like you to pay attention to here is that with Google Analytics set up on your newdomain.com website, you can minimize the number of 404 pages. Just think of a pretty common scenario: someone may have linked to a page on your olddomain.com and if the redirection is not working, you'll find yourself sending users to an error page.

Checking your 404 pages eventually improves the UX of your website and make your visitors and crawlers' life easier (aka big win for your SEO).

But how can you check your 404 error pages in Google Analytics?

One easy way is the following one:

  • When in GA, navigate to Behavior > All pages
  • Select the "Page title" tab from your reporting window
  • Add "404" or "Page not found" in the search box
  • Click through each page you'd get from that query

You could also dig into more details and set up alerts for 404 pages. If you'd like to do that, please check Google documentation here.

Update as many incoming links as you can

The very last step you now have left with is critical to your SEO rankings: incoming links. At this stage, where the transfer of your website has been already taken care of, redirects are in place, and you already did anything you could to let Google (and other search engines) know about the change, it's time to focus on setting up incoming links.

So start with those you're in control of:

  • Facebook
  • Twitter
  • Google+
  • LinkedIn
  • Instagram
  • ... and so on

Then update all your email signatures where any link to your website might be provided and update them with the new site's domain name.

Last but not least, you'd need to reach out to website owners that are linking to you and ask them to update their links to your new site.

Final checks

You're almost there but there are still some things you might want to check out to be sure your new website now running on newdomain.com doesn't bring awful situations along the way.

Check your email service settings

When migrating your website to a new home, all services you've connected to it need to be updated and the email service you're relying on is no exception. So check your opt-in forms, links in your automated emails, links to your logo, etc.

Don't ever forget that visitors browsing through broken links might affect your click-through rate, thus affect your overall SEO (because of 404 error pages and a higher bounce rate).

Check for broken links

For the same reason, you don't just set up redirects without testing if they're properly working (or not). So fire up a query with a tool to check your broken links and act on them accordingly. It's way better that you'd find the problems and fix them yourself than to have someone among your visitors to find them.

Delete your cache files

Some caching plugins will modify your .htaccess, so if you have a caching plugin installed, delete your cache files and let the plugin generate new ones.

Even if you're using plugins for moving a website, always be 100% focused when performing such a task Click To Tweet

Wrapping things up

Migrating your WordPress website to a new domain is an extremely delicate task that should always be paired with a huge "handle with care" stamp. This doesn’t mean only programmers, developers or coders would be able to do that. Don't forget one important thing, though; the availability of plugins, which help you out (a lot), can take away your attention to perform such a critical task. And this isn't good.

As you now have all the steps required for migrating your website to a new domain listed out, two recommendations are all that remains here: always backup your databases and, if you’re not sure about which step you should take along the way, ask for help.

Guessing and trying don't belong here.

WordPress SEO Checklist DownloadQuality: The Codeable Differene

  • Very informative and useful for those who having doubts.

    • Glad you like it :)

      • Good is to have articles like this by hand. Keep going with them, we are going to follow it for sure.

  • Erik Haagensen

    Can you take down the wordpress installation and just leave the .htaccess file with the redirects in it?

    • Liam Bailey

      Yes – once you have moved your site you can take down the WordPress and leave just the .htaccess with the redirects. .htaccess is like the elevator-boy of the server, he will send the traffic where he is told regardless of whether the page exists on that server or not. You might want to take out any other code from the ,htaccess apart from that related to the redirects as in the blog post, or at the very least move the redirect code to the top of the htaccess file.

      • Erik Haagensen

        Thank you sir.

  • Nice article Matteo, there are some tips here I can add to my migration workflow.

    One thing I find useful for the database is using WP Migrate DB. It allows you to create a ‘new server’ ready database file, by handling the path and url search and replace for you when creating the file. It also archives the file using gzip compression making for a faster upload.

  • Hi Matteo, I have a question for you. In some cases i need to move olddomain.com to newdomain.com, and then newdomain.com to newdomain1.com, then newdomain1.com to newdomain2.com and so on. Any advice on how to proceed in this case? Thanks

  • great article, but why should i have a clean and new install of wordpress? no reason for that, you can download the files with wordpress itself.

    with that said, what the reason to check “your menus, widgets and all other custom settings and options”? while migrating the DB everything stays exactly the same as in the migrated website.