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.

Setting phpMyAdmin to point to an Amazon RDS instance

Isn’t it annoying how you can’t ssh in to Amazon RDS instances?  Don’t you wish there was a way you could use trusty old phpMyAdmin to manage your db?  Here is the easy way to do it:

  1. Find the endpoint link to your RDS server.  It’s found in the instance information section.  It usually looks something like this: xxx.amazonaws.com
  2. Install phpMyAdmin somewhere.  I recommend on a webserver so you can access anywhere.
  3. cd phpMyAdmin
  4. sudo cp -p config.sample.inc.php config.inc.php
  5. Change this line in config.inc.php:
$cfg['Servers'][$i]['host'] = 'localhost';

to

$cfg['Servers'][$i]['host'] = '<link found in (1)>';

 

That’s it!