How to change your WordPress site address
Help centreOn this page
This guide shows how to change the address of a WordPress site, for example from http to https, or from an old domain to a new one, and how to update links that still use the old address.
Before you start
- Take a backup or check when the last one ran.
- For https, install your certificate first. See how to install a free SSL certificate.
- For a new domain, add it to your hosting and point it at us first. See how to point your domain at our hosting.
Change the address in Settings
- Log in to WordPress.
- Go to Settings, then General.
- Change WordPress Address (URL) and Site Address (URL) to the new address, for example
https://yourdomain.co.uk. Don’t add a slash at the end. - Click Save Changes. You’ll be logged out.
- Log in again at the new address.
If the two boxes are greyed out, the address is set in wp-config.php by lines starting define( 'WP_HOME' and define( 'WP_SITEURL'. Change them there in File Manager.
Update the old address in your content
Pages, menus and widgets still contain links and image addresses using the old address. You need to search for it and replace it across the database.
WordPress stores some settings as serialised data, which records the length of each piece of text. A plain find and replace in phpMyAdmin changes the text but not the length, which can break widgets and theme settings. Use one of the tools below, as they handle this properly.
With WP Toolkit
- Log in to cPanel and click WP Toolkit.
- Find your site and open its Database tab or section.
- Look for Search and Replace. The wording may differ between versions.
- Enter the old address, for example
http://yourdomain.co.uk, and the new address. - Run the replacement, then check your site.
With WP-CLI
On our WordPress plans you can use WP-CLI over SSH. Go to your WordPress folder and run a test first, which shows what would change without changing it:
wp search-replace 'http://yourdomain.co.uk' 'https://yourdomain.co.uk' --dry-run
If the numbers look right, run the same command again without the last part to make the changes. Then clear any cache.
If it doesn’t work
- You can’t log in after saving. Edit
wp-config.phpand setWP_HOMEandWP_SITEURLto the address that works, then log in and correct the settings. - The browser shows a padlock warning on https. Some images or scripts still load over http. Run the search and replace again, and check your theme settings.
- The site keeps redirecting in a loop. Clear your browser cookies and any caching plugin, then check both address boxes match exactly.
Good to know
After moving to a new domain, set up a redirect from the old one so visitors and search engines find the new address. Ask us in a ticket if you’re unsure how.
Still stuck? Open a support ticket and we’ll help.
WP Toolkit, staging, backups every six hours and free migration of your site.