Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared hosting Managed WordPress Cloud hosting VPS hosting By reader location Hosting finder
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Blog Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Troubleshooting

WordPress Not Working After Changing Site URL: Causes and How to Fix It

WordPress Not Working After Changing Site URL: Causes and How to Fix It

Short answer

WordPress breaks after a URL change because the home and siteurl values now point somewhere wrong. Add WP_HOME and WP_SITEURL with the correct address to wp-config, or edit both rows in the options table, then run a safe search and replace and clear caches.

Key takeaways

  • The Site Address and WordPress Address are stored as home and siteurl in the options table.
  • WP_HOME and WP_SITEURL in wp-config.php override a wrong database value.
  • Old links inside content need a serialization-safe search and replace.
  • Install SSL before switching the URL to https to avoid redirect loops.
  • Login loops usually mean the URL fields and the address you use do not match.

Why does WordPress stop working after you change the site URL?

WordPress breaks after a URL change because it stores the address in the database and uses it for every link, redirect and login cookie, so a wrong value sends you to a page that does not work.

The two values involved are home (Site Address) and siteurl (WordPress Address). Both live in the wp_options table and are set under Settings > General.

If you type a domain that does not point to your server, switch to HTTPS before SSL works, or add a typo, WordPress obediently redirects everything to the wrong place. The dashboard often becomes unreachable at the same moment.

Our explainer on WordPress General Settings shows what each of these fields does. This guide focuses on getting back in and fixing the damage.

What symptoms show the site URL is wrong?

Common symptoms are redirects to the wrong domain, a login page that reloads, a page with no styling, too many redirects errors, or a blank or not found page.

Match what you see to the likely cause:

SymptomLikely cause
Redirects to an old or wrong domainTypo or old value in home or siteurl
Too many redirects errorHTTP and HTTPS mismatch, or a proxy or CDN conflict
Page loads with no CSS or imagesFiles still requested from the old address
Login page refreshesCookie domain does not match the new URL
Not secure or certificate errorHTTPS set before SSL was installed
Site cannot be reachedDomain does not point to your server yet

Knowing the symptom saves time. A redirect loop needs a different fix from a missing stylesheet.

How do you fix the site URL with wp-config.php?

Add WP_HOME and WP_SITEURL constants with the correct address to wp-config.php; they override the database values so you can log in and fix things.

  1. Connect to your site with your host's file manager or SFTP.
  2. Open wp-config.php in the WordPress root folder.
  3. Above the line that says That's all, stop editing, add:
define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com' );
  1. Replace the address with your real one, without a trailing slash.
  2. Save the file and load the site.

If you cannot find the file, see our guide on where to find wp-config.php.

These constants grey out the URL fields in General Settings. That is fine to keep, but if you want to edit the fields from the dashboard again, update the database values and then remove the two lines.

How do you fix the site URL in the database?

Open phpMyAdmin, find the options table, and edit the siteurl and home rows so they contain the correct full address.

  1. Log in to your hosting control panel and open phpMyAdmin.
  2. Select your WordPress database. The name is in wp-config.php as DB_NAME.
  3. Open the wp_options table. Your prefix may differ from wp_.
  4. Find the rows named siteurl and home. They are usually near the top.
  5. Click Edit on each, enter the correct address and save.

The phpMyAdmin documentation covers the interface if you have not used it. Export a copy of the database before you edit anything.

If you have SSH access, WP-CLI is faster. Run wp option update home 'https://example.com' and wp option update siteurl 'https://example.com'.

Changing the two URL fields does not update links stored inside posts, widgets, menus and page builder data, so those still point to the old address until you run a search and replace.

WordPress saves full URLs inside post content, image blocks, custom menu links and plugin settings. These are separate from the home and siteurl values.

Fix them with a careful search and replace:

Never use a plain SQL find and replace on the whole database. Many plugins store serialized arrays that record string lengths, and changing the length without updating that count corrupts the data.

After replacing, regenerate page builder CSS and clear every cache. Our guide on fixing broken links after migration covers the remaining cleanup.

How do you fix too many redirects after changing to HTTPS?

Fix the redirect loop by making sure the SSL certificate works, both URL fields use https, and your CDN or proxy SSL mode matches how the server serves HTTPS.

A redirect loop often happens when WordPress forces HTTPS but the server, or a proxy in front of it, keeps sending the request back as HTTP.

Check these in order:

  1. Certificate. Load the address in a browser. If you see a certificate warning, install SSL before using https in the URL fields.
  2. Cloudflare or another proxy. A Flexible SSL mode sends HTTP to your server, which can loop with an HTTPS redirect. Cloudflare's SSL documentation explains the modes, and Full (strict) is the usual choice.
  3. Duplicate redirects. Remove extra HTTPS redirects from .htaccess, a security plugin and an SSL plugin so only one remains.

Our guide to fixing too many redirects walks through each case.

Why can't you log in after changing the site URL?

You cannot log in because WordPress sets login cookies for the configured domain, so if the URL fields and the address you use differ, the cookie is rejected and the login page reloads.

Common versions of this problem:

  • www vs non-www. The fields use www.example.com, but you visit example.com, or the reverse.
  • HTTP vs HTTPS. Secure cookies are not sent over a plain HTTP connection.
  • Old domain. The fields point to a domain that no longer reaches the server.

Set both fields to the exact address you want visitors to use, using wp-config.php or the database. Then clear browser cookies for the site and log in again.

If the problem continues, read our guide on fixing the login page refreshing and redirecting.

What if the new domain does not load at all?

If the new domain shows a DNS error or another site, the domain is not pointing to your hosting yet, so WordPress settings cannot help until DNS is fixed.

Check that the domain's A record or nameservers point to your host. DNS changes can take a few hours to spread, although many update much faster.

Also confirm the domain is added to your hosting account. Most hosts need you to add it as the main domain, an addon domain or an alias before it serves your files.

Our guide on pointing a domain to WordPress hosting explains the records to set.

How do you change the site URL safely next time?

Change the URL safely by backing up first, installing SSL before switching to HTTPS, updating both fields together, then running a search and replace and adding redirects.

Use this order:

  1. Back up the files and database.
  2. Point the new domain to the server and install the SSL certificate.
  3. Update home and siteurl together.
  4. Run a search and replace for the old address, with a dry run first.
  5. Add a 301 redirect from the old domain to the new one.
  6. Clear all caches and test logged-in and logged-out views.

For a full domain move, follow our step-by-step guide to changing the domain of a WordPress site.

Frequently asked questions

How do I change the WordPress site URL back without dashboard access?

Add WP_HOME and WP_SITEURL constants with the correct address to wp-config.php, or edit the siteurl and home rows in the options table with phpMyAdmin. If you have SSH, the WP-CLI option update command changes them in seconds.

Why is my site showing no styling after changing the URL?

The page is still loading CSS, scripts and images from the old address, or from HTTP on an HTTPS page. Correct both URL fields, run a search and replace for the old address, regenerate page builder CSS and clear every cache.

Is it safe to use SQL to replace the old URL?

A plain SQL replace is risky because many plugins store serialized data that records string lengths. Changing a URL's length breaks those entries. Use WP-CLI search-replace or a plugin like Better Search Replace, which handle serialized data correctly.

Why are the URL fields greyed out in General Settings?

The WP_HOME and WP_SITEURL constants are defined in wp-config.php, or your host sets them. The constants override the database, so edit them in the file. Remove them if you want to manage the fields from the dashboard again.

How long does it take for a new domain to work?

Once DNS records point to your host, many changes work within an hour, but some can take up to a day or two to spread worldwide. Until then, some visitors may still reach the old server or see an error.

Sources

  1. wp search-replace WordPress Developer Resources
  2. Better Search Replace WordPress.org
  3. phpMyAdmin documentation phpMyAdmin
  4. SSL/TLS Cloudflare Docs

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

Written and checked byWPLegible Editorial Team Independent WordPress reviews and guides

Researched from the primary sources listed above and checked against our editorial rules before publishing.