• 100% Canadian Company
  • Call Us: 1-888-99-DOT-CA (1-888-993-6822)

Change and Update WordPress URL's in the Database Print

  • 370

After moving your WordPress site to a new URL, the new URL's in the MySQL database will need to be updated in the MySQL tables.  This can be updated via phpMyAdmin.

To update via phpMyAdmin: 

- Login to your cPanel account (https://www.canspace.ca/clients/knowledgebase.php?action=displayarticle&id=23)

- Click on the phpMyAdmin icon under the database section.

- Once phpMyAdmin loads, select the WordPress database.

- Select the SQL tab on the right hand side of the screen and enter the following, replacing oldurl with the old URL you were using and newurl with the new URL you are wanting to use*:

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

Notes:

If the table prefix is different than wp_, this will need to be updated.
There will be no trailing stashes added to the code

* If you are unsure on what to replace the values with, you can use the following code generator:
https://codepen.io/EightArmsHQ/full/nzEjI

Was this answer helpful?

« Back