I’ve been working on a WordPress site recently that started at one URL and then needed to be changed. Let’s pretend the site currently lives at oldurl.com and now it’s going to become newurl.com. The hosting and database will all remain the same, I’m just changing which URL is associated with the website.
For old fashioned static HTML websites this would be a simple fix. Just update the Domain Name Server (DNS) information for the two URL’s and voila! The newurl.com would point to the site and everything would work, at this point you could setup forwarding from oldurl.com to direct any links or visitors trying to find you. With a WordPress site however, things are a bit more difficult than that because it’s not just the image files and HTML that’s making the website run, it’s the MySQL database and PHP files that rely on information from the old URL. If you don’t update these you’ll end up with a broken looking page like the one below.
If you simply change the DNS info for the two URL’s and then visit newurl.com you will see a page load but most of the links will be broken and it probably won’t look right. If you try to fix it by logging into the wp-admin page you’ll still be stuck because that page no longer works! What you need to do here is replace every instance of oldurl.com with newurl.com in your MySQL database, once you do that the website will work just like before.
- Change the DNS settings so your new URL is associated with the hosting space for your WordPress files
- Log into the MySQL database associated with the WordPress website and use the search function to find all instances of “oldurl.com” and manually replace them with “newurl.com”
- Log into MySQL at your website host, this requires a username and password
- Once in, on the left you will see two items on the left “information_schema” and below it the name of your database “databasename” with little plus icons
- Click on the second item “databasename” and then click the “Search” tab a the top of the page
- In the box type the name of the old url you’re replacing, then below click the “Select All” to search all of the tables
- Now go through all of the results and paste in your new URL, once they are all done your site will work!
Just below is an image of the MySQL search page, replace “oldurlhere.com” with the name of your old site.
Here’s a quick video walkthrough of the steps above, leave a comment if you’re having trouble and good luck!