How do I update the domain name of my WordPress site?
Rebrands and name changes take place from time to time, so you might need to update the domain name that your site uses. Or, you may have finally finished creating your site on a development domain or subdomain and be ready to bring your site live, but you’re unsure how to go about doing so.
Due to the nature of WordPress databases, updating every single internal reference from your old domain to your new one can be time-consuming and difficult. WordPress sites use the URL of the main site for a lot of different internal processes, so it’s important to know how to update this properly to minimise disruption.
How you go about updating the URL depends on the type of package the WordPress site is built on. We’ll break down both instances below, as well as going into alternative ways to update the URLs, such as via the database or using Search and Replace.
Our WordPress Hosting platform includes inbuilt tools to update the site’s core settings in the form of the Settings area. To access this:
- Log into My20i and head to your Manage Hosting area
- Select Options > Manage on the hosting package you’d wish to edit
- Under the WordPress Tools section of your package and select the Settings button
Here, you’ll see areas where you can set the Site URL and Home of your WordPress site. Update these fields to the new URL, and hit Save Settings.
For Linux Web Hosting, you need to change the URL in WordPress Admin. Head to the site’s wp-admin area and edit these details in Settings > General:
Then hit Save Changes.
Alternatively, if you can’t access wp-admin, you can head to the site’s database and update these details in the _options table:
- Log into My20i and head to your Manage Hosting area.
- Select Options > Manage on the hosting package you’d wish to edit.
- Head to the Web Tools section and select phpMyAdmin
- Select Sign In on your MySQL database. If you’re unsure which database is for your site, check your wp-config.php file.
- You’ll be signed into phpMyAdmin. Select your database on the left, then the _options table from the list
- You'll see entries for ‘siteurl’ and ‘home’. Edit the values of these entries and your site’s URL will be updated.
Editing the database of your site manually can be risky if you’re unfamiliar with the process.
Alternatively, you can use a third-party plugin to do it for you.
We recommend Better Search Replace. This plugin provides an easy to understand UI in your wp-admin area where you can search for certain entries in your site’s database and update them. This includes searching for your current site URL and updating it.
To do this:
- Log into your wp-admin area of your site, and search for the Better Search Replace plugin in your site’s Plugins > Add New area
- Select Install and Activate
- Better Search Replace will now appear as an option under Tools. Select it from the dropdown menu, and you’ll be presented with a form like below:
- Enter your current URL in Search for and the URL you’re updating to in Replace with. You’ll see further down a selection of checkboxes:
- Use Run as dry run if you want to see what tables the search and replace will update without actually changing anything, and hit Run Search/Replace
- Once you’re happy with what changes will be made, uncheck the Run as dry run option and run the search and replace again
This will update all of your site’s URLs in the database for you.
Updating your site’s URL on WordPress can be handled with multiple different tools and approaches depending on where and how your site is hosted. Always make sure to take backups before making any major changes like this, to ensure that you have a restore point.
Do I need to add a redirect to allow my WordPress site to load the new URL?
WordPress should automatically redirect any attempts to connect to your old URL to the new domain you’ve added, so a redirect shouldn’t be required.
I finished updating all of my site’s URLs but the old site still shows, what’s going on?
It’s likely due to one of three reasons. Either the old URL still exists inside the domain in some form, a redirect exists on the domain that is correcting to the old URL or the old URL is caching.