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.
- 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.
- Add a robots.txt file to the new site
robots.txton the new domain (or edit it through your Yoast SEO plugin settings), with the following contents:
- 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!
- 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.comwith the new domain).
- 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.
- 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.
- 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.
- 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!
- 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.
- 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!
- Event October 26 - 27, 2021 Team Yoast is sponsoring News and Editorial SEO Summit 2021, click through to see if we'll be there, who will be there and more! See where you can find us next »
- SEO webinar 23 November 2021 Register for our SEO news webinar in November 2021. Our SEO experts Jono and Joost will talk you trough the latest Google and WordPress news. All Yoast SEO webinars »