Account

Error guide / WordPress login redirect loop

How to fix a WordPress login redirect loop

In a WordPress login redirect loop you enter the correct username and password, press Log In and land on wp-login.php again, often with reauth=1 or redirect_to in the address bar and no error message. Sometimes the browser gives up and shows ERR_TOO_MANY_REDIRECTS instead. Either way, by the time the request reaches /wp-admin/ WordPress does not consider you logged in, so it sends you back to log in and the cycle repeats. The password is almost never the cause: a wrong password shows an error, and a loop shows none.

Check your site

>

What causes it

WordPress keeps you logged in with cookies tied to a specific host and path, and the loop starts when the cookie set at login does not come back with the next request to the admin. The usual reason is a mismatch between the WordPress Address and Site Address settings, for example one with www and the other without, or one on http and the other on https. You log in on one host and are sent to the admin on another, where the cookie does not apply. Almost as common is HTTPS behind a proxy or CDN: the visitor is on https, but the server only sees plain http coming from Cloudflare or a load balancer. WordPress then decides the request is not secure, looks for the wrong cookie or redirects to https again, and the redirects go in a circle. Other causes are a page cache or CDN that caches wp-login.php or /wp-admin/, a wrong COOKIE_DOMAIN in wp-config.php, a security or redirect plugin, and duplicate https or www rules in .htaccess that undo each other.

How to fix it

  1. Run the check on this page for https://your-site.com/wp-admin/, using the address you actually log in at. A healthy site answers with one 302 redirect to wp-login.php with redirect_to and reauth=1, and that login page returns 200. The check sends no cookies, so it sees what a logged-out visitor sees. If the chain is clean, the loop happens only after login, and the cause is in cookies, the proxy setup or caching. If the check reports a redirect loop, or the chain bounces between http and https or between www and the bare domain, you have found the conflict without logging in.
  2. Compare the two addresses in Settings, General: WordPress Address (URL) and Site Address (URL). Both must use the same scheme and host as the address in your browser: normally https in both, and www in both or in neither. If you cannot reach the admin to change them, add define('WP_HOME', 'https://your-site.com'); and define('WP_SITEURL', 'https://your-site.com'); to wp-config.php above the line that says to stop editing. These constants override the values in the database.
  3. If the site runs behind Cloudflare, a load balancer or a reverse proxy, WordPress has to see the request as HTTPS. In Cloudflare, set SSL/TLS to Full (strict) instead of Flexible. For other proxies that send the X-Forwarded-Proto header, add this to wp-config.php before wp-settings.php is loaded: if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') { $_SERVER['HTTPS'] = 'on'; }
  4. Exclude the login page and the admin from every cache. A caching plugin, the server's page cache or a CDN rule such as Cache Everything must never cache wp-login.php, /wp-admin/ or any request that carries a wordpress_logged_in cookie. Purge the cache after changing the rule.
  5. Rule out plugins and .htaccess. Rename the wp-content/plugins folder over FTP or in the file manager to switch off all plugins at once, then try to log in. If that works, rename the folder back and reactivate the plugins one at a time, starting with security, redirect and caching plugins. In .htaccess, look for duplicate rules that force https or www and keep a single canonical redirect.
  6. Finally, clear the site's cookies in your browser or try a private window, and check wp-config.php for a COOKIE_DOMAIN line. If it names a different host from the one you log in at, remove the line: WordPress picks the right cookie domain by itself.

Related errors