What this problem is
After logging in, WordPress may redirect you to the wrong domain, the homepage, or back to the login screen repeatedly.
Why it happens
siteurl/homemismatch (HTTP vs HTTPS or wrong domain)- Old cookies for a different domain/subdomain
- Forced redirects from caching/security plugins or CDN
- Incorrect reverse-proxy settings (SSL termination)
Prerequisites
- Access to wp-config.php or database (phpMyAdmin)
- Ability to clear cache (plugin/server/CDN)
Diagnosis
Step 1) Confirm the final URL after login
Note if it changes protocol (http/https) or domain (www/non-www).
Step 2) Clear cookies for the domain
Clear cookies and cache for the site, then try again.
Detailed steps
Step 1) Force correct URLs in wp-config.php (temporary)
Add:
define("WP_HOME", "https://example.com");
define("WP_SITEURL", "https://example.com");
Expected result: redirects follow the correct domain/protocol.
Step 2) Fix URLs in database (if needed)
In {prefix}options, update siteurl and home to the correct URL.
Step 3) Purge cache (plugin/server/CDN)
Purge all caching layers after changing URLs.
Step 4) Check security plugin settings
Disable features like hide login, cookie restrictions, or enforced redirects to a custom URL, then retest.
Expected results
- Successful login and stable redirect to Dashboard
- Correct domain and HTTPS usage
What to do if it fails
- Check if your site is behind a proxy and set
$_SERVER["HTTPS"]correctly (host-specific) - Review the
redirect_toparameter and any must-use plugins
Best practices
- Keep a single canonical domain (www or non-www) and enforce it consistently
- After migrations, always verify
home/siteurland clear caches