QUESTION: How we can change Change and Update WordPress URLS in Database When Site is Moved to new Host?
ANSWER: When migrating a WordPress site to a new URL either to a live production site or a testing development server, the new URL strings in the MySQL database need to be changed and updated in the various MySQL database tables.
First of all, we have do a MySQL database export of the old database on the old server, create a new blank database on the new server, import the old data either in PHPMyAdmin or mysql
After that we have to use below query as below. Also if needed change the table prefix values where applicable (i.e. wp_ )
ANSWER: When migrating a WordPress site to a new URL either to a live production site or a testing development server, the new URL strings in the MySQL database need to be changed and updated in the various MySQL database tables.
First of all, we have do a MySQL database export of the old database on the old server, create a new blank database on the new server, import the old data either in PHPMyAdmin or mysql
After that we have to use below query as below. Also if needed change the table prefix values where applicable (i.e. wp_ )
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.new_url') WHERE option_name = 'home' OR option_name = 'siteurl'; UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.new_url'); UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.new_url'); UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.new_url');For reference :
No comments:
Post a Comment