NASTIA

I’m a WordPress enthusiast, proud to be WPMU DEV-ian, site builder

Update URLs Through phpMyAdmin After Site Migration

Nastia
0 Comments

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');

Replace the www.oldurl with your old url and www.newurl with your new domain name. Click on “Go” and within seconds all URLs will be replaced on entire site or network of sites.

Categories
WordPress
COMMENTS (No comments)

Leave a Reply

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