How to change your WordPress site URL
Change WordPress’s address safely: in settings, in wp-config.php when you’re locked out, and in the database after moving domain or switching to HTTPS.
On this page
WordPress stores its own address in two settings: WordPress Address (siteurl) and Site Address (home). Get them wrong and you can be redirected away from your own site.
Method 1: in settings
If you can log in: Settings → General, change both addresses, save.
Method 2: wp-config.php (when locked out)
- Open System Info & Files › File Manager and edit
wp-config.phpin the WordPress folder. - Above the line
/* That's all, stop editing! */, add:
define('WP_HOME', 'https://yourdomain.co.uk');
define('WP_SITEURL', 'https://yourdomain.co.uk');- Save and reload the site.
These override the database values. Once you can log in, you can fix the settings and remove the lines, or leave them in place.
Method 3: phpMyAdmin
- Open phpMyAdmin and your WordPress database.
- Open
wp_options. - Edit the
siteurlandhomerows.
After changing domain or moving to HTTPS
Posts, image links and some plugin settings still contain the old address. Use a search-and-replace tool designed for WordPress, which correctly updates serialised data, to replace the old URL with the new one. A plain SQL REPLACE can corrupt serialised settings.
Take a backup first. How to back up WordPress
Prefer to follow along?
- Back up WordPress and prove you can restore it
Intermediate · 45 min - Move a WordPress site to Traxio
Intermediate · 60 min
Choosing somewhere to host WordPress? Traxio’s WordPress hosting includes one-click installs, LiteSpeed caching and free SSL.
If it doesn’t work
These guides cover the most common problems, starting with what you can see. Or browse every fix for a common problem.
- Fix a WordPress critical error without admin accessFind the plugin or theme behind ‘There has been a critical error’ using logs and the File Manager, disable it, and recover.
- Blank white page: how to find the hidden errorA completely blank page usually means a PHP error that isn’t displayed. How to reveal it with logs and fix the cause.
- “Too many redirects” and HTTPS redirect loopsFix ERR_TOO_MANY_REDIRECTS: conflicting HTTPS and www rules in .htaccess, WordPress settings, plugins and Cloudflare’s SSL mode.
- How to log in to WordPress adminWhere the WordPress login page is, what to do if you’ve forgotten the password or the password reset email never arrives.
Common questions
How do I change my WordPress site URL?
For a simple change, edit the WordPress Address and Site Address in Settings → General. If you are moving to a different domain, the URL also appears throughout your content and has to be replaced in the database with a search-and-replace tool.
Editing only the two settings on a domain move leaves images and internal links pointing at the old address. If the change locks you out of wp-admin, the values can be set in wp-config.php instead.
Spotted something out of date or unclear? Tell us and we’ll fix it.