Move your WordPress blog to a new domain

A friend recently asked me how to move his blog, which is on /blog/ on his domain, to a new domain on it’s own. The steps are easy, but have to be taken in the right order to make sure you’re not annoying your users and the search engines:

  1. Put up a robots.txt on the new domain with the following contents:
    User-agent: *
    Disallow: /
  2. Copy the database and files to the new domain.
  3. Edit wp-config.php to 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');
  4. 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).
  5. 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.
  6. Once you’re done, and you’ve checked everything works twice:
  7. Remove the robots.txt file.
  8. On your old blog, add the following line to your apache .htaccess or vhost-config:
    Redirect 301 /blog/ http://www.newdomain.com/
  9. Remove the old blog code and database.
  10. Change your FeedBurner account, if you have one, to pick up the correct feed.

That should be it. 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!

Revisions

There are no revisions for this post.

Tags: , ,

No comments yet.

Leave a Reply