Changing your WordPress site address sounds like a one-field job: type the new URL, click save, done. Then the page reloads into an error, your dashboard disappears, and you’re locked out of your own site. It happens to a lot of site owners — and it’s completely avoidable.
This guide shows you when you actually need to change the site address, how to prepare, the safe ways to make the change, how to fix old links, and what to do if you end up in a redirect loop.
WordPress stores two URLs in Settings → General:
For most sites, both are the same. You’ll need to change them when you:
http:// to https:// after installing SSL.www and non-www versions./wp/) to the root.Never change your site address without a full backup. If something goes wrong, a backup turns a disaster into a five-minute restore.
wp-config.php and wp-content.Need a backup tool? Compare options in Best Backup Plugins for WordPress Compared.
Method 1: Settings (simplest)
https://.Method 2: wp-config.php (when you can’t reach the dashboard)
If you’re locked out, open wp-config.php in your hosting file manager and add these two lines above the line that says “That’s all, stop editing!”:
define( 'WP_HOME', 'https://newdomain.com' );
define( 'WP_SITEURL', 'https://newdomain.com' );
These override the database values, so you can log back in immediately. The fields in Settings will appear greyed out while these lines are present.
Method 3: phpMyAdmin — in the wp_options table, edit the siteurl and home rows. Use this only if you’re comfortable working in the database.
Changing the site address doesn’t update links inside your content. Images, internal links, and menus may still point to the old URL, which causes broken images and mixed-content warnings.
The fix is a search and replace across the database:
wp search-replace 'http://olddomain.com' 'https://newdomain.com'.If you changed domains, also set up 301 redirects from the old domain to the new one so visitors and search engines follow you, and update the domain in Google Search Console.
“Too many redirects” is the most common problem after a URL change. Work through these checks:
.htaccess for old redirect rules that point back to the previous address.Still stuck? Use the wp-config.php method above to force the correct URLs, then fix the rest from the dashboard.
wp-config.php to recover if you get locked out.We may earn a commission on purchases made through these links, at no extra cost to you.
Don’t miss the chance to participate in the biggest giveaway of this year.