Site icon Hostreta

How to Change Your WordPress Site Address Without Breaking It

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.

When you need to change the site address

WordPress stores two URLs in Settings → General:

For most sites, both are the same. You’ll need to change them when you:

Backing up before you start

Never change your site address without a full backup. If something goes wrong, a backup turns a disaster into a five-minute restore.

  1. Back up the database — this is where the URLs are stored.
  2. Back up your files, especially wp-config.php and wp-content.
  3. Download the backup to your computer, not just to the server.
  4. Make sure you can reach your hosting panel and file manager, in case you get locked out of WordPress.

Need a backup tool? Compare options in Best Backup Plugins for WordPress Compared.

Changing the URL in Settings or wp-config

Method 1: Settings (simplest)

  1. Go to Settings → General.
  2. Update both the WordPress Address and the Site Address to the new URL — always change them together.
  3. Make sure the new domain already points to your hosting and SSL is active if you’re using https://.
  4. Click Save Changes. You’ll be logged out; log in again at the new address.

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.

Fixing old links 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:

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.

Troubleshooting redirect loops

“Too many redirects” is the most common problem after a URL change. Work through these checks:

  1. HTTP vs HTTPS mismatch: make sure both URLs use the same protocol and that SSL is really active on the domain. Read What Is SSL? How to Get HTTPS for Free if you’re unsure.
  2. www vs non-www: confirm your URLs match the version your host or CDN redirects to.
  3. Cloudflare SSL mode: “Flexible” mode often causes loops on HTTPS sites; switch to “Full” or “Full (strict).”
  4. Clear every cache: your caching plugin, server cache, CDN, and browser.
  5. Check .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.

Key takeaways

Exit mobile version