Move WordPress to a new domain in 10 easy steps!

Sometimes, branding, technical or business decisions mean that you need to change your domain. If you’re not careful, a poorly managed move can really hurt your SEO. Thankfully, WordPress makes things pretty easy – here’s everything you need to do.

10 steps to move WordPress

This guide assumes that you’re moving from one domain to another. If your migration is more complex (e.g., a subdomain on one site, to a folder on another), you may need to adapt the instructions.

  1. Take a backup of everything

    There’s a lot that can go wrong if you’re not careful when you start moving files and databases around. If you run into problems, it’s best to make sure that you can hit a ‘reset’ button and restore a backup.

  2. Add a robots.txt file to the new site

    Upload a robots.txt on the new domain (or edit it through your Yoast SEO plugin settings), with the following contents:

    User-agent: *
    Disallow: /

  3. Copy everything across

    Get a copy of your files and a copy of your database, then move everything across to your new hosting environment. You may need to configure your storage and database settings!

  4. Configure your wp-config.php file

    Make sure that you have the right database settings for the new hosting environment, and add the following lines (replacing example.com with the new domain).

    define('WP_SITEURL', 'https://www.example.com');
    define('WP_HOME', 'https://www.example.com');

  5. Access and configure your site

    Now everything should be accessible on the new website; but you should definitely double-check, and make sure that all of your settings are correct.

    If you have a caching plugin or system, don’t forget to empty out all of the old data.

  6. Find and replace old domain values

    Install the Search and Replace plugin, and do a search and replace for your old domain name with your new domain name.

  7. Remove the robots.txt file on the new site

    Now that your website is set up and ready to go, you can remove the robots.txt file which is preventing Google from seeing it.

  8. Set up a redirect on your old site

    Use your tool of choice to set up a redirect on your old site, so that all requests to your old domain trigger a 301 redirect to (the same page on) the new domain. Test this thoroughly!

  9. Remove your old code and database

    Apart from whatever code or tools you’re using to power the redirect from the old site to the new one, you can remove all your old code, content and databases.

  10. Update external services

    Don’t forget to change the settings on all of your third-party accounts which reference or integrate with your website. They’ll need the new domain name!

That should be it, you’ve moved WordPress to a new domain. If you have any suggestions or spot things that I’ve missed, please note them in the comments!

Read more: 6 questions about redirects for SEO »

Coming up next!


9 Responses to Move WordPress to a new domain in 10 easy steps!

  1. Dennis
    Dennis  • 5 years ago

    And what to do with redirects on your old domain? Do you just copy your .htaccess and will that take care of it?

    • Jono Alderson

      Hi Dennis, it depends on how your site it set up. If you’re still using a .htaccess file on your old domain to power the redirects, you’ll need to keep that in place.

  2. Suresh Khirwadkar
    Suresh Khirwadkar  • 5 years ago

    A great summary thanks! I didn’t really understand the part about the wp-config though. If I have access to the admin area and have set my site there do I need to edit the wp-config files at all?

    Another thing i’m having an issue with is on my computer it keeps redirecting to my old host (on a free secondary domain there) even though I clear the cache, cookies, content etc. It doesn’t do it on VPN so I know it’s not the site that’s an error. Any advice?

    • Jono Alderson

      Setting the values in the site admin is less reliable than hard-coding it in the wp-config file, so that might be the root of your problem!

  3. Marek F.
    Marek F.  • 5 years ago

    I guess this should work for me transferring from SaaS platform to WordPress too? I would not like loosing my precious links but feel limited within current platform and have to migrate for sure.

    • Jono Alderson

      Yep, the same principles apply! Some of the steps might be a little more complex as you’re not just ‘moving’ a site, but rather, migrating from one system to another.

  4. Emmanuel
    Emmanuel  • 5 years ago

    Thanks for the steps. But I feel comfortable outsourcing these kind of task than taking the risk, won’t like to mess around with any of the technical issues of moving to a new domain.

  5. Wouter Blom
    Wouter Blom  • 5 years ago

    Yes! and a clean transfer is advised. SO NO changes tot the website when transferring from odl domain to new domain. OLD url structure has to be the same to the new one. And patience is advised!

    Google does not like it if you transfer domains AND URL structure. It can take months extra to transfer rankings and value even in best case!

    • Kundan Kumar
      Kundan Kumar  • 5 years ago

      My Question is bit different.
      Should we go with Expired Domains in this Era?? Do they are still effective? I was thinking to start with expired domains having good Domain authority?