"This page isn't working: example.com redirected you too many times" (ERR_TOO_MANY_REDIRECTS) means two rules keep sending the browser back and forth. The fastest way to fix it is to see the actual chain of redirects, then remove the rule that disagrees with the others.
Before you start
- A terminal with curl, or a browser's developer tools (Network tab with "Preserve log").
- Access to the site's .htaccess or server config, app settings and CDN dashboard.
Trace the loop
curl -sIL --max-redirs 10 https://example.com | grep -iE '^(HTTP|location|server|cf-ray)'The output alternates between URLs, for example:
HTTP/2 301 location: https://example.com/
HTTP/2 301 location: http://example.com/The pattern tells you the cause: HTTPS↔HTTP, www↔non-www, or trailing slash↔no slash. The server header shows whether the redirect came from the CDN or the origin.
Cause 1: Cloudflare Flexible SSL with forced HTTPS on the origin
With Cloudflare's Flexible mode, Cloudflare talks to your server over HTTP. If the server or app redirects HTTP to HTTPS, every request loops. Fix: install a certificate on the origin (free AutoSSL or Let's Encrypt) and set Cloudflare SSL/TLS mode to Full (strict).
Cause 2: HTTPS behind a reverse proxy or load balancer
The proxy terminates HTTPS and forwards plain HTTP, so the app thinks the request is insecure and redirects again. Pass the scheme from the proxy (proxy_set_header X-Forwarded-Proto $scheme;) and tell the app to trust it:
- WordPress: in
wp-config.php, set$_SERVER['HTTPS'] = 'on';whenHTTP_X_FORWARDED_PROTOis https. - Laravel: trusted proxies configuration.
- Django:
SECURE_PROXY_SSL_HEADER. - Flask:
ProxyFixmiddleware.
Cause 3: conflicting www or HTTPS rules
One layer redirects to www and another to the bare domain, or both .htaccess and the app force a different host. Pick one canonical URL (e.g. https://example.com) and make every layer agree:
- Remove duplicate redirect rules from
.htaccess, Nginx and plugins; keep one place responsible. - Check redirect settings in cPanel (Domains → Redirects) and in the CDN (Page Rules, Redirect Rules).
Cause 4: application URL settings
The app's configured address must match the canonical URL exactly:
- WordPress:
homeandsiteurl(Settings → General, orwp option update). - Laravel:
APP_URL; Magento: base URLs; PrestaShop: shop URL settings; Ghost:urlin config.
Cause 5: login or cookie loops
Some loops only happen after logging in: the app sets a cookie for one host but redirects to another, or secure cookies are sent over HTTP. Fix the canonical host and HTTPS detection as above, then clear cookies.
Clear cached redirects
Browsers cache 301 redirects aggressively, so a fixed site may still loop for you. Test in a private window, clear site data, and purge the CDN and page cache (LiteSpeed Cache, Cloudflare).
Check the fix
Run the curl command again. You want at most one or two hops ending in HTTP/2 200 on your canonical URL.
Redirect loop FAQ
Why does it work in one browser but not another?
One browser has a cached redirect or old cookies. Clear them, or test with curl, which caches nothing.
Can a plugin cause loops?
Yes: SSL, redirect, caching and multilingual plugins can all add redirects. Disable them one by one to find the culprit.
How many redirects are acceptable?
Ideally one (e.g. http → https canonical). Chains of several redirects slow pages and dilute SEO signals.
