Migrating a WordPress website

When you move a WordPress website from one server to another, or change the url of a site, or add an SSL, one of the things you need to do is update all the links in the site’s database.

If you know how to use PHPMyAdmin there are four queries that will do this for you which will update all your images, posts, options and the site and home url.

UPDATE wp_options SET option_value = replace(option_value,"http://oldsite.com","http://newsite.com");
UPDATE wp_posts SET guid = replace(guid,"http://oldsite.com","http://newsite.com");
UPDATE wp_posts SET post_content = REPLACE (post_content,"http://oldsite.com","http://newsite.com");
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value,"http://oldsite.com","http://newsite.com");

So here’s a quick form to generate them for you (nothing is saved on my server!)

Enter your new and old URLs without trailing slashes...