Skip to content

Change your WordPress url in mySQL

If you are planning to migrate your website to a new domain name or want to change your domain name for some reason. Then you can use this little code snippet to achieve this.

Please remember we don’t take responsibility if something goes wrong! You must always back up and be cautious when working with the MySQL database. In fact, if you are not a developer then this is a very advanced step to take!

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


The Next Gen of Managed WordPress Service You deserve more than just a Hosting company! Hosting, Maintenance, Secure, Content updates and Cloud Backups

We are more than just a Hosting company!

AdminWP Host, Maintain (Site-care), Secure and Backup WordPress websites.