What the Error Means
Chrome and other Chromium-based browsers show ERR_TOO_MANY_REDIRECTS with a message that the page redirected you too many times; other browsers word it differently. Address A redirects to B, and B redirects back to A, or a longer chain ends where it began. The browser follows a fixed number of hops and then gives up. The cause is almost always in the server, CDN, or application configuration.
If You See It on Someone Else's Site
- Clear the site's cookies: in your browser's settings, delete cookies and cached data for that site only, then reload.
- Try a private window: if the page loads there, an old cookie was the cause.
- Tell the site owner: if it fails in a private window too, the loop is on their side.
Trace the Loop with curl
curl -IL --max-redirs 10 http://example.com/
-I asks for headers only and -L follows each redirect. Every hop prints a status line, such as 301, and a location header. Read the location lines in order: http to https and back to http, or example.com to www.example.com and back, shows the two rules in conflict. curl stops with an error once the limit of 10 is reached.
HTTPS Redirect Behind a CDN in Flexible Mode
This is the most common cause on sites behind Cloudflare. In Flexible SSL mode the edge connects to your server over plain HTTP, even when the visitor uses HTTPS. If the server redirects every HTTP request to HTTPS, the edge receives that redirect, passes it to the visitor, the visitor asks again over HTTPS, and the edge again fetches over HTTP.
The lasting fix is a certificate on your server and the SSL mode set to Full (strict). The server's own redirect then works, and traffic between the edge and the server is encrypted. If the edge then reports a handshake failure, see Cloudflare error 525.
WordPress Site Address Settings
WordPress redirects to the address saved in its home and siteurl options. If they say http:// while the server forces HTTPS, or name www while the server removes it, the two loop. Take a database backup, then check and correct them with WP-CLI in the site's folder:
wp option get home
wp option get siteurl
wp option update home 'https://example.com'
wp option update siteurl 'https://example.com'
Values set with WP_HOME and WP_SITEURL in wp-config.php override the database, so check that file too.
HTTPS Detection Behind a Proxy
An application behind a proxy or CDN sees plain HTTP from the proxy and may keep redirecting to HTTPS. The proxy sends the original scheme in the X-Forwarded-Proto header. For WordPress, add this near the top of wp-config.php:
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
$_SERVER['HTTPS'] = 'on';
}
Rely on this header only when every request reaches the server through your proxy; otherwise anyone can set it.
Conflicting www Rules
A web server rule that removes www and an application or CDN rule that adds it will loop forever. Choose one name and redirect in one place. In Nginx:
server {
listen 80;
server_name example.com www.example.com;
return 301 https://example.com$request_uri;
}
The HTTPS block for www.example.com redirects to example.com in the same way, and the HTTPS block for example.com serves the site with no redirect at all. Run sudo nginx -t before you reload. Then remove any CDN page rule or plugin setting that redirects the other way.
Confirm the Fix
curl -IL http://www.example.com/
Expect at most one or two hops that end on the canonical address with 200. Clear the site's cookies in your own browser before testing there. If the final answer is 404, see 404 Not Found; the codes themselves are listed in HTTP status codes explained.