Website redirects to the wrong domain or subfolder due to misconfigured site URL.
Incorrect Site Address (URL)
Key Points: WordPress URL or Site URL is wrong, causing redirects to old domains, subfolders, or localhost.
You open your site and end up in a parallel universe — maybe an old domain, maybe localhost. WordPress is trying to load from the wrong address, and your browser is just playing along.
🔍 Why It Happens
- Moved WordPress to a new domain but didn’t update URLs
- Site URL changed manually or by a plugin
- Database import from another site without replacing URLs
🛠️ How to Fix It
- Add correct values to
wp-config.php:define('WP_HOME','https://yourdomain.com'); define('WP_SITEURL','https://yourdomain.com'); - Then go to Settings → General and double-check
- If locked out, run a database search & replace using WP-CLI or a plugin
💡 Pro Tip
Never hardcode URLs in theme files. Use WordPress functions like home_url() or site_url() for portability.