Migrating WordPress the easy way

UPDATE
I now advise using interconnectit’s php script method instead of the method below, because it’s more reliable.

If you search on Google, there are tons of tutorials on migrating WP.  I found all of them hard to follow and overly complicated.  Follow these simple steps to easily move a WordPress (WP) website:

1) Copy the WP root folder to the new location

2) If also migrating the db, use phpMyAdmin to export the WP tables from the old db and import them into the new

3) Point a browser to the new WP location.  It should work, but all of the db is still pointing to the old WP location so we have to fix that

4) Run these sql commands in phpMyAdmin:

update wp_posts set post_content = replace ( post_content, "<old website location>", "<new website location>");

update wp_posts set guid = replace ( guid, "<old website location>", "<new website location>");

update wp_options set option_value = replace ( option_value, "<old website location>", "<new website location>");

5) Last, make sure you setup mod_rewrite on your new web server if you are using mod_rewrite on your old one.