Moving WordPress to a different domain

This is a quick not on how to move your WordPress site to a different domain. Usually this is no a task performed often, however as a developer you will have the need to do so on a regular bases when publishing a site.

This post is very quick writeup on how to do so. First step, obviously: fix the settings in wp-config.php . Next run the following queries:

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';

UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');

That should do the trick. Off course change new-domain.com and old-domain.com to the appropriate values.