So you’ve migrated a site to a new host with a new domain and forgot to change the site’s URLs. No worries a simple solution you can try is to change them within the phpMyAdmin.

Go to your cPanel and locate the phpMyAdmin icon. Click on it and you will be redirected to it.

Default caption

 

Make sure you have the new database selected, then run some sql updates and replacement commands on the tables notably, wp_options, wp_posts, wp_postmeta.

Don’t forget to replace wp_ prefix with your own 😉
​

UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');

UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');

Add comment