A friend recently asked me how to move his blog, which is on /blog/ on his domain, to a new domain on its own. The steps to move WordPress are easy, but have to be taken in the right order to make sure you’re not annoying your users and the search engines. I know a lot of people dread this, hence this 10 step guide to a simple WordPress migration:
10 steps to move WordPress
- Put up a
robots.txton the new domain with the following contents:
User-agent: * Disallow: /
- Copy the database and files to the new domain.
wp-config.phpto have the right database settings, and add the following lines, replacing sample.com with the right domain:
define('WP_SITEURL', 'http://www.example.com'); define('WP_HOME', 'http://www.example.com');
- Now set up your blog install, with the same settings as on the old domain (if you have a caching plugin installed, delete your cache files).
- Install the Search and Replace plugin, and do a search and replace for your old URL’s and change them with your new URL’s.
- Once you’re done moving WordPress, and you’ve checked everything works twice:
- Remove the
- On your old blog, add the following line to your apache
Redirect 301 /blog/ http://www.newdomain.com/
- Remove the old blog code and database.
- Change your FeedBurner account, if you have one, to pick up the correct feed.
Of course, these same instructions should help when you simply move WordPress from one domain to the other and are not changing a directory, just be sure to omit the directory from the redirect line above. 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!
Quick note; if you’re switching to VPS.net because of my WordPress hosting article, you can make it easy on yourself: they’ll do the whole migration for you!