Moving a WordPress Site

I love WordPress and I use it pretty much exclusively for small to mid-sized website development. WordPress development is quick, easy and website owners love the fact that there’s none of the complications that come with proprietary content management systems. Sometimes it becomes necessary to move your beloved WordPress sites to other servers or directories. I’ve found many online resources elaborating on this topic including the WordPress docs themselves. I prefer to have a quick reference guide for my own purposes though. I’ve given credit and links where applicable.

If you’re moving a WordPress site to a different server or a different directory on the current server there are several steps to go through to ensure that everything works correctly on the other side of the move.

The Database Edits: (from My Digital Life)

SQL From phpMyAdmin or similar: (in phpMyAdmin go to the top level of the database by clicking on the db name and click on the “SQL” tab. don’t forget to add the appropriate db table prefix if different from the default wp_ )

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’);

On occasion you may need to add this to your config.php file: (from the WordPress Codex)

define(‘WP_HOME’,’http://www.new-site-location.com’);
define(‘WP_SITEURL’,’http://www.new-site-location.com/subdirectory-if-applicable’);

Sometimes it’s necessary to update permalinks by simply going to SETTINGS > PERMALINKS and clicking on SAVE CHANGES. you don’t have to change anything, just click the button. Not sure why but it works.

The WordPress Codex has a detailed article on moving WordPress available.

Don’t forget to check your theme files (and Flash!) for hard-coded file paths.