Sometimes you may need to change the URL or website address of your WordPress website. In this guide we will show you a simple and systematic way to do this.
Change the URL of your WordPress Website
Backup your website.
This process is quite straightforward but you can break your site so proceed with caution and backup your WordPress website first! We recommend Updraft Plus for this process
Make sure your new domain is setup
Your new domain should be setup and resolving to your existing website. This may be done with a "domain alias". You should consult your web host about the best way to do this on their platform.
Install Better Search Replace Plugin
You can do this from your Plugins menu. The plugin is also available in the WordPress repository here.
Tell WordPress about the new URL
You can do this under Settings > General. You will need to set the Home URL and the Site URL which will usually be the same thing.
This will automatically update any internal links within menus, locations of featured images etc, but you will still need to replace the url where it is used within inline images or other content areas. We will solve this in the next step.
Run Better Search and Replace against your database
This step is destructive - proceed with caution and make sure your database is backed up! If you mess this up and your database is not backed up you will almost definitely break your entire website, probably irreparably! Heed this warning!
- Open the Search and Replace plugin page from the Tools menu
- Search for your old URL and replace with your new URL
- Select the tables to search. Start with wp_options, wp_posts and wp_postmeta
- You may wish to test with a dry run initially, if so leave the Dry run box ticked
Test
Assuming all has gone well, your website should now be working from the new URL.
Article published 05th November 2020
Last modified 04th January 2024