"ERR_TOO_MANY_REDIRECTS": Causes & Fix

The site keeps redirecting the browser in a circle until it gives up. Here is how to see the loop hop by hop, and the fix for each common cause.

What you'll seeChrome / Edge
example.com redirected you too many times. ERR_TOO_MANY_REDIRECTS
  1. redirected you too many times The browser followed 20 redirects without reaching a page: the site redirects in a loop.
Covers
Redirects, Cloudflare

Most likely fix

  1. Trace the chain with the Website Redirect Checker (or curl -sIL) and find the URL that repeats.
  2. On Cloudflare, change SSL/TLS mode from Flexible to Full (strict). Behind another proxy, pass X-Forwarded-Proto and make the app trust it.
  3. Do the HTTPS and www redirects in one place only, and make the app’s site URL match the final address.

"ERR_TOO_MANY_REDIRECTS" means the site sent your browser in a redirect loop: page A redirects to B, and B (directly or after a few more hops) back to A. The browser gives up after 20 redirects. The loop almost always comes from two layers that disagree about HTTPS or the hostname. Typical pairs are Cloudflare's Flexible SSL mode with a server that forces HTTPS, an app behind a proxy that can't tell the request was already HTTPS, or a www rule in one place that undoes the one in another. The fix is to find the two hops that point at each other and remove one of them.

What It Looks Like

# Chrome / Edge This page isn’t working example.com redirected you too many times. Try deleting your cookies. ERR_TOO_MANY_REDIRECTS # Firefox The page isn’t redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. # Safari Safari Can’t Open the Page Too many redirects occurred trying to open “https://example.com/”. # curl -L curl: (47) Maximum (50) redirects followed

Chrome suggests deleting cookies because a cookie sometimes causes the loop. Most loops are in the server configuration, though, and every visitor sees them.

Why It Happens

1. Cloudflare "Flexible" SSL with a server that forces HTTPS

This is the most common cause. In Flexible mode, Cloudflare serves HTTPS to the visitor but connects to your server over plain HTTP. Your server sees an HTTP request and redirects it to https://. Cloudflare passes that redirect to the browser, the browser asks Cloudflare over HTTPS again, and Cloudflare once more fetches over HTTP. Other CDNs and load balancers set up to reach the origin over HTTP cause the same loop.

2. An app behind a proxy that doesn't know the request was HTTPS

Behind a reverse proxy, load balancer or container ingress, TLS ends at the proxy, and the app receives plain HTTP. If the app forces HTTPS itself (WordPress, Laravel, Django, Express and Rails all can), it sees "HTTP" on every request and redirects forever. The proxy has to send X-Forwarded-Proto: https, and the app has to trust it.

3. www rules that cancel each other out

One layer redirects www.example.com to example.com and another redirects it back. For example, Nginx strips www while the CMS's site URL contains it, or a hosting panel and a CDN page rule each pick a different hostname.

4. WordPress site URL doesn't match the real address

WordPress redirects every request to its Site Address (home) setting. If that says http:// while the server or a plugin forces HTTPS, or names a different hostname than the server prefers, the two keep redirecting each other.

5. A rule that matches its own target

A rewrite rule without a condition redirects the already-redirected URL again. For example, an Apache rule that sends everything to HTTPS without first checking %{HTTPS} off, or a trailing-slash rule in the server that fights the opposite rule in the app (/page to /page/ and back).

A protected page redirects to the login page. The login page sees a session cookie and redirects back, but the protected page rejects that cookie. Typical reasons are a cookie set for the wrong domain, a Secure cookie on an HTTP page, or a stale session. This is the case where clearing cookies for the site actually helps.

Browsers cache permanent redirects301 and 308 responses are cached, so the browser can keep looping after the server is fixed. Diagnose with curl or a private window, never with your normal browser tab.

How to Diagnose It

Follow the chain hop by hop and print only the status line and the Location header. The loop shows up as the same URLs repeating:

bash
curl -sIL --max-redirs 6 http://example.com/ | grep -iE '^(HTTP|location)' # HTTP/1.1 301 Moved Permanently # location: https://example.com/ # HTTP/2 301 # location: https://example.com/ <- redirects to itself # HTTP/2 301 # location: https://example.com/ # ... # curl: (47) Maximum (6) redirects followed

A URL that redirects to itself over HTTPS usually means the server can't see that the request was already HTTPS (causes 1 and 2). Two URLs that alternate, such as www and non-www, mean conflicting rules (causes 3 and 4). If curl doesn't loop but your browser does, a cookie or a cached redirect is the cause (cause 6, or the callout above).

Behind a CDN, look at which layer sends the redirect: the server header and headers like cf-ray show whether Cloudflare or your server answered. You can also skip the CDN and ask the origin directly:

bash
# Ask the origin directly, as the CDN would in Flexible mode (plain HTTP) curl -sI -H 'Host: example.com' http://203.0.113.10/ | grep -iE '^(HTTP|location|server)' # ...and over HTTPS, as it would in Full mode curl -skI --resolve example.com:443:203.0.113.10 https://example.com/ | grep -iE '^(HTTP|location|server)'
Trace the redirect chain without a terminalThe Website Redirect Checker lists every hop with its status code, target and server.
Check the redirects

How to Fix It

Fix A: Use Full (strict) SSL on Cloudflare

In the Cloudflare dashboard, go to SSL/TLS → Overview and change the mode from Flexible to Full (strict). Your server needs a certificate Cloudflare trusts: a Let's Encrypt certificate or a free Cloudflare Origin CA certificate. Then turn on Always Use HTTPS in Cloudflare, so the HTTP-to-HTTPS redirect happens at the edge. Turning off your server's HTTPS redirect also ends the loop, but it leaves the connection from Cloudflare to your server unencrypted, so use Full (strict) instead.

Fix B: Pass the original scheme through the proxy

Have the proxy send X-Forwarded-Proto, and tell the app to trust it:

nginx
# Nginx in front of the app location / { proxy_pass http://127.0.0.1:8080; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } // WordPress: wp-config.php, above "That's all, stop editing!" if (($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '') === 'https') { $_SERVER['HTTPS'] = 'on'; } # Django: settings.py SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') // Express app.set('trust proxy', 1);

Laravel does the same through its TrustProxies middleware, and Rails through config.assume_ssl or the proxy settings of config.force_ssl.

Fix C: Pick one hostname and redirect to it in one place

Decide whether the site lives on www or the apex, and do the redirect in one layer only. Make sure the app's own URL setting matches. In Nginx, give each redirect its own server block, so the target block can't redirect again:

nginx
# All HTTP to the HTTPS apex server { listen 80; server_name example.com www.example.com; return 301 https://example.com$request_uri; } # HTTPS www to the HTTPS apex server { listen 443 ssl; server_name www.example.com; # ssl_certificate ... (must cover www too) return 301 https://example.com$request_uri; } # The real site: no redirect here server { listen 443 ssl; server_name example.com; # ... }

In Apache .htaccess, always put a condition before the rule so it only fires on HTTP:

apache
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Fix D: Correct the WordPress site URL

If you can't reach the dashboard, set both URLs in wp-config.php (or with WP-CLI) to the exact address the site should use, scheme and hostname included:

php
// wp-config.php define('WP_HOME', 'https://example.com'); define('WP_SITEURL', 'https://example.com'); # or with WP-CLI wp option update home 'https://example.com' wp option update siteurl 'https://example.com'

If the loop started after installing an SSL or redirect plugin, disable it by renaming its folder in wp-content/plugins, then check again.

As a visitor, delete the cookies for that one site (click the icon to the left of the address in Chrome, then Cookies and site data). As the site owner, check that the session cookie is set for the domain the app actually runs on, that the site is fully on HTTPS if the cookie is Secure, and that the login page doesn't redirect users who only have an expired session. The Cookie Checker shows the attributes your site sets.

One hop is enoughRedirect every variant straight to the final URL: http://www.example.com should go directly to https://example.com, not through https://www.example.com first. Every extra hop adds a round trip to the first page load.

Verify the Fix

Check all four combinations of scheme and hostname. Each should end with a 200 on the same final URL after at most one redirect:

bash
for u in http://example.com http://www.example.com https://example.com https://www.example.com; do printf '%-28s ' "$u" curl -sIL --max-redirs 5 -o /dev/null -w '%{http_code} %{num_redirects} hops -> %{url_effective}\n' "$u/" done # http://example.com 200 1 hops -> https://example.com/ # http://www.example.com 200 1 hops -> https://example.com/ # https://example.com 200 0 hops -> https://example.com/ # https://www.example.com 200 1 hops -> https://example.com/

The HTTPS Redirection Test and WWW Redirection Test run the same checks from the browser.

Frequently Asked Questions

1. Does clearing cookies fix ERR_TOO_MANY_REDIRECTS?

Only when a cookie causes the loop, for example a stale login or language cookie that sends you back and forth. Chrome suggests it because it is a quick thing to try. If the loop is in the server or CDN configuration, every visitor sees it, and clearing cookies changes nothing. Test with curl, which sends no cookies: if curl loops too, the problem is on the server.

2. Why does the loop start right after I enabled Cloudflare?

Almost always because the SSL/TLS mode is **Flexible**. Cloudflare then talks to your server over plain HTTP, your server redirects that request to HTTPS, and Cloudflare passes the redirect back to the browser, which asks again over HTTPS. Set the mode to **Full (strict)** and install a certificate on the origin (a free Cloudflare Origin CA certificate works).

3. How many redirects does a browser follow before giving up?

Chrome and Firefox stop after 20; curl stops after 50 by default. A healthy site needs one redirect from any variant (for example http://www.example.com straight to https://example.com), two at most. Each extra hop slows down the first page load.

4. Why do I still see the error after fixing the server?

Browsers cache 301 and 308 redirects, sometimes for a long time, so an old redirect can keep sending you into the loop. Test in a private window or with curl. To clear it in Chrome, open DevTools, tick **Disable cache** on the Network tab, and reload; clearing the browser cache also works.

5. Can HSTS cause a redirect loop?

Not by itself. HSTS makes the browser switch to https:// before sending the request (DevTools shows it as a 307 Internal Redirect). It does stop you from escaping a loop by visiting the http:// URL, though, so the HTTPS side has to work. See HSTS errors.

6. Is ERR_TOO_MANY_REDIRECTS bad for SEO?

Yes, while it lasts. Googlebot also gives up on long redirect chains and loops, reports the URL as a "Redirect error" in Search Console, and drops it from the index if the loop stays. Once it is fixed, use **URL Inspection → Request indexing** to get the page re-crawled sooner.