Home / WordPress / Incorrect Redirects After WordPress Login: Fixes

Incorrect Redirects After WordPress Login: Fixes

Fix login redirects that send you to the wrong URL or back to the login page, focusing on site URLs, cookies, and security rules.

Views: 18 Unique: 15 Updated: 2026-03-18

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/home mismatch (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_to parameter 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/siteurl and clear caches
Back to category