Moving Your WordPress Blog to a New Domain Without Losing Your Incoming Traffic

u-haul-truck-pictureAs you may have read in the previous entry I recently came back into possession of jamespoling.com.  After selling off a blog network and taking a break from blogging I had recently started blogging again at jpoling.com.  I was never 100% happy with that URL and when I was able to, the first thing I wanted to do was move everything over to jamespoling.com.

The problem with that is, that I already had some pretty good search engine traffic as well as links from other outside sources and I didn’t want to lose any of that traffic with the move.  All those incoming links and that tasty SEO I love so much, I really didn’t want to sacrifice any of that.  The good news is, you don’t have to.

Google usually frowns upon duplicate content on different sites, so I’ll have to monitor the situation and when the incoming links from jpoling.com start to slow to a trickle, I’ll more than likely go in and axe the entire domain and set up a 301 redirect to here.

Click after the jump for the step by step to moving your WordPress blog to a new home.

This set of instructions assumes that you already have your new blog set up at your new domain with your old content already imported in.  If for some reason you haven’t gotten that far or are stuck, feel free to contact me and we’ll get it worked out.

Once you have your new blog set up, make sure you are using the same permalink structure that you were using in your old blog.  e.g. If you were using Month and Name (/%year%/%monthnum%/%postname%/) on your old domain, make sure that’s what you have set on your new domain.  You can find those options in admin >> settings >> permalinks.

To run SQL queries, login to MySQL database that houses WordPress tables via phpMyAdmin or login to the DB server and run MySQL client as root.

  1. To update WordPress options with the new blog location, use the following SQL command: UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
  2. The URL values in this field are stored as absolute URLs instead of relative URLs, so it needs to be changed with the following SQL query: UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');
  3. Use the following SQL commands to fix all internal links to own blog in all WordPress posts and pages: UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');

That’s it!  Your done.  When someone visits or clicks on a link to your old URL they will be automatically forwarded to your new URL.  If they click on an incoming link like http://jpoling.com/2009/01/google-reveals-hidden-features-in-iphone-app/ they will be automatically redirected to http://jamespoling.com/2009/01/google-reveals-hidden-features-in-iphone-app/.  Go head, try it out.  Type in jpoling.com in your browser and see where you end up.  Enjoy!

Related entries:

About James
If you'd like to contact the author of this post you can send an email to james@jamespoling.com. If you enjoyed this post, please consider leaving a comment or subscribing to the feed to have future articles delivered to your feed reader. Or, if you'd like, you can follow me on Twitter.

Comments

Trackbacks

  1. [...] my outside links and Google traffic by changing my permalink structure. I already showed you how to migrate a WordPress site to an entirely new domain and redirect your URLs, this is just another quick customization along the same [...]

blog comments powered by Disqus