Introduction
When the WordPress home URL and site URL stop matching the real public hostname, the site often starts behaving like it belongs somewhere else. Logins may bounce between domains, assets may load from the wrong address, and admin screens can become unreliable after a migration, staging copy, or reverse proxy change. The fix is to determine which URL WordPress should trust and then remove any competing overrides.
Symptoms
- Logging in sends you to the wrong domain or a redirect loop
- CSS, JavaScript, or images load from an old hostname
- WordPress admin links point to staging, localhost, or a previous domain
- The site works on one hostname but breaks on the canonical one
- The issue started after migration, SSL enablement, or a domain change
Common Causes
siteurlandhomevalues differ in the WordPress databasewp-config.phphardcodes one or both URLs incorrectly- A search-and-replace or migration left old domain values behind
- Reverse proxy or SSL termination causes WordPress to detect the wrong scheme or host
- A plugin or host-level redirect conflicts with the intended canonical URL
Step-by-Step Fix
- Decide the exact public URL WordPress should use, including whether it should be
wwwor non-wwwand whether HTTPS is required. - Check the
homeandsiteurlvalues in the WordPress database or under Settings > General if wp-admin still loads. - Review
wp-config.phpforWP_HOMEorWP_SITEURLconstants that may be overriding the database values. - If the site sits behind a proxy, CDN, or load balancer, confirm WordPress receives the correct host and HTTPS information.
- Update the URL values so
homeandsiteurlmatch the intended hostname unless you have a deliberate reason to separate them. - Re-test login, dashboard navigation, and front-end asset loading after clearing any page, object, or CDN cache layers.
- If old links still appear, inspect serialized options, theme settings, or plugin configuration left behind from a migration.
- Check web server or application redirects so they reinforce the same canonical hostname instead of fighting WordPress.
- Keep the final URL source simple and documented so future migrations do not reintroduce conflicting overrides.