Below are a couple simple steps to update your WordPress blog’s URL. The below is valid if you are simply switching the URL using the same domain or if you are changing the WordPress domain all together. You will run into problems if you do not make sure to update each item.
- Update WordPress SiteURL: In the database table wp_options make sure to change siteurl to the new URL. This should be the first row in the wp_options table.
- Change Blog Address: Under “Settings” and then “General” change the “Blog Address” to the new URL.
- Update Permalinks: Now update your permalinks by running the following SQL from phpMyAdmin or from the MySQL CLI.Update WordPress Permalinks:
- UPDATE qd_db_posts SET guid = REPLACE (
- Modify URL’s: Images or other items that are referenced within articles should be relative URL’s however many times people add the entire URL including domain name. To make sure that no previous links go to the old site issue the below command in MySQL to update any references within articles to the old WordPress URL.Update WordPress Post Content Referencing Old URL:
- UPDATE wp_posts SET post_content = REPLACE (post_content,'http://www.olddomain.com','http://www.newdomain.com');
- Verify Settings: Visit your new blog URL and make sure the new settings are all functioning properly. Make sure to test pages that use permalinks.
Your WordPress blog should now be functional at the new URL.
**NOTE** If you are having issues uploading files to the WordPress Media Library after moving servers or modifying domains then check out this article that explains how to modify the upload_path option_value using the MySQL CLI.