First, take a backup of mysql database and create a new database on the new server & import the exported data.

Now run some sql updates and replacement commands on the tables: wp_options, wp_posts, wp_postmeta.

Use the code as below and swap in your old and new URLs, no trailing slashes.

Commands:-

UPDATE wp_options SET option_value = replace(option_value, ‘http://CURRENT_URL’, ‘http://NEW_URL&#8217😉 WHERE option_name = ‘home’ OR option_name = ‘siteurl’;

UPDATE wp_posts SET guid = replace(guid, ‘http://CURRENT_URL’,’http://NEW_URL’);

UPDATE wp_posts SET post_content = replace(post_content, ‘http://CURRENT_URL’, ‘http://NEW_URL’);

UPDATE wp_postmeta SET meta_value = replace(meta_value,’http://CURRENT_URL’,’http://NEW_URL’);

Please login or Register to submit your answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.