Change site url when moving site to another url?

Those parameters and admin settings change the URLs in the database. The only other way to do that is run SQL queries on the DB in phpmyadmin to change them:

UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com') WHERE option_name="home" OR option_name="siteurl";

UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');

UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');

UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://olddomain.com', 'http://newdomain.com');

Update 1/16/2015: it’s much better to use a script that deals with serialized data, such as interconnectit.com WordPress Serialized PHP Search Replace Tool

Leave a Comment