wordpress site to replace the domain name how to quickly set

  Sometimes our wordpress site for various reasons need to replace the domain name, and how to quickly set up the site to make direct use of the new domain name and it will not be affected? For example, the old domain name is a.com, new domain name b.com, the following piece of code is useful sql

UPDATE wp_options SET option_value = REPLACE(option_value, 'http://www.a.com', 'http://www.b.com') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://www.a.com', 'http://www.b.com');

UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://www.a.com','http://www.b.com');

UPDATE wp_comments SET comment_content = REPLACE (comment_content, 'http://www.a.com', 'http://www.b.com');

UPDATE wp_comments SET comment_author_url = REPLACE (comment_author_url, 'http://www.a.com','http://www.b.com');

UPDATE wp_posts SET guid = REPLACE (guid, 'http://www.a.com', 'http://www.b.com') WHERE post_type = 'attachment';

  The domain name for the site option_value wp_options  

  wp_posts the content of the article is post_content

Guess you like

Origin www.cnblogs.com/ytkah/p/11424068.html