Move WordPress site to another domain – change URLs

If you need to move WordPress site from one server to another and  your domain name or URLs change – i.e. from http://olddomain.com to http://newdomain.com, you have to apply the SQLs bellow on you database:

UPDATE wp_options set option_value=’http://newdomain.com’ WHERE option_name = ‘siteurl’;
UPDATE wp_options set option_value=’http://newdomain.com’ WHERE option_name = ‘home’;
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 wp_posts SET post_excerpt = REPLACE (post_excerpt,’http://olddomain.com’,’http://newdomain.com’);

Replace http://newdomain.com with your new domain url, and http://olddomain.com with your old domain url.

Share This!
Posted in WordPress
One comment on “Move WordPress site to another domain – change URLs
  1. Marius says:

    Nice post

Leave a Reply

Your email address will not be published. Required fields are marked *

*