Fix ERR_TOO_MANY_REDIRECTS "redirected you too many times" (redirect loop)
This page isn’t working example.com redirected you too many times. Try deleting your cookies. ERR_TOO_MANY_REDIRECTS
- net::ERR_TOO_MANY_REDIRECTS
- 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 Can’t Open the Page. Too many redirects occurred trying to open “https://example.com”.
- curl: (47) Maximum (50) redirects followed
- Ce site vous a redirigé à de trop nombreuses reprises. ERR_TOO_MANY_REDIRECTS
The server redirects the page to a URL that in turn redirects back to the first one, forever. The number one cause is Cloudflare in "Flexible" SSL mode with a server that forces HTTPS: switch Cloudflare to "Full (strict)". Otherwise, look for two conflicting rules (HTTP/HTTPS, www/non-www, login) with curl -IL.
What this error means
A redirect (a 301, 302, 307 or 308 code with a Location header) tells the browser to fetch the page somewhere else. Browsers follow about twenty redirects at most, then give up with this error. A loop forms when two layers disagree: for example, the proxy talks HTTP to the server, the server thinks the visit is HTTP and redirects to HTTPS, the browser comes back over HTTPS, the proxy talks HTTP again… The same pattern exists between www and non-www, or between a protected page and a login page that itself requires being logged in.
Common causes
- Cloudflare in "Flexible" SSL: Cloudflare contacts your server over HTTP, your server (or WordPress, Laravel,
.htaccess) redirects to HTTPS, and so on. - Proxy or load balancer not recognised: the application does not read
X-Forwarded-Protoand always thinks it runs over HTTP. - Conflicting www and non-www: the server redirects to
www, the CMS (WordPress site address) redirects to the non-wwwversion. - Authentication loop: the login page is itself protected by the auth middleware, or a session/cookie is never stored (wrong cookie domain or
secureflag). - Cookies or a cached 301: the configuration is fixed but the browser replays an old permanent redirect.
Step-by-step fix
-
See the redirect chain
curl shows each hop: the loop is obvious (two URLs alternating). Also test in a private window to rule out cache and cookies.
curl -sIL --max-redirs 10 http://example.com | grep -iE "^(HTTP|location)" -
Cloudflare: switch to Full (strict)
In the Cloudflare dashboard > SSL/TLS > Overview, choose "Full (strict)". You need a valid certificate on your server (Let’s Encrypt or a Cloudflare origin certificate). Avoid "Flexible": traffic between Cloudflare and your server stays unencrypted.
-
Make the app recognise the proxy HTTPS
Laravel 11+: trust the proxy (limit it to its IPs if the server is reachable directly). WordPress: add the block to
wp-config.php, before therequire_once ABSPATH . 'wp-settings.php';line.// Laravel: bootstrap/app.php ->withMiddleware(function (Middleware $middleware) { $middleware->trustProxies(at: '*'); }) // WordPress: wp-config.php if (($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '') === 'https') { $_SERVER['HTTPS'] = 'on'; } -
One single canonical redirect rule
Pick one final URL (for example
https://example.com) and redirect everything else to it in one hop, in one place. Then set the same address in the CMS (WP_HOME,WP_SITEURL) or inAPP_URL.server { listen 80; server_name example.com www.example.com; return 301 https://example.com$request_uri; } server { listen 443 ssl; server_name www.example.com; ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; return 301 https://example.com$request_uri; } -
Check the login routes
The login route must not be protected by the
authmiddleware. In Laravel, it belongs to theguestgroup. Also checkSESSION_DOMAINandSESSION_SECURE_COOKIE: a cookie the browser rejects sends you back to the login page forever.php artisan route:list --path=login -v -
Clear the site cookies and cache
In Chrome: DevTools > Application > Storage > Clear site data, or the icon left of the address > Site settings > Delete data. Since 301 redirects are cached, always retest in a private window after a fix.
Did this fix work for you?
Confirm it in one click: it will rise for the next developers stuck on the same error.
Keep it from coming back
- Handle the HTTP to HTTPS redirect at one level only (Cloudflare "Always Use HTTPS" or the web server), not in three layers at once.
- Use 302 redirects while testing and switch to 301 once the configuration is validated: a wrong 301 stays cached for visitors.
- After each change, check the full chain with
curl -ILforhttp://,https://, with and withoutwww.
Frequently asked questions
Is deleting cookies enough?
Only if the loop comes from a corrupted cookie or an old cached redirect. If curl -IL also shows the loop, the problem is server-side and all your visitors see it.
Why right after enabling Cloudflare?
Cloudflare is often set to "Flexible" SSL by default: it contacts your server over HTTP, and your force-HTTPS rule sends the request back to HTTPS in a loop. Switch to "Full (strict)".
How do I unlock WordPress if I can no longer reach the admin?
Define WP_HOME and WP_SITEURL in wp-config.php with the right URL, or fix them with wp option update home and wp option update siteurl (WP-CLI).
Useful tools for this error
Error finder
Paste an error message or a log: the tool recognises the error and opens the right fix.
cURL converter
Paste a cURL command (DevTools “Copy as cURL”): get the fetch, axios, Node, PHP (Laravel Http or curl) or Python requests code.
HTTP status codes
All the common HTTP codes (401, 403, 404, 419, 429, 500, 502…): meaning, causes and what to do.
More Web, HTML & CSS errors
- Fix "Mixed Content: … requested an insecure resource" (HTTPS mixed content)
- Fix "Refused to apply style … MIME type ('text/html') is not a supported stylesheet MIME type"
- Fix "Failed to load module script: Expected a JavaScript module script … MIME type of text/html" (Vite, SPA)
- Fix "Refused to execute inline script because it violates the following Content Security Policy directive"
- Fix "Your connection is not private" NET::ERR_CERT_DATE_INVALID and ERR_CERT_AUTHORITY_INVALID
- Fix "ResizeObserver loop completed with undelivered notifications"
- Fix net::ERR_BLOCKED_BY_CLIENT (ad blocker, analytics, "ads" files)