- Checked
- 2026-11-14
Too many redirects: two rules send visitors in a circle
The browser followed redirects until it gave up, about twenty in a row. Somewhere two rules disagree: one sends http to https and another sends it back, or www and the bare domain point at each other.
See the loop
Run the free redirect checker on the address, or ask curl, which prints every hop:
curl -sIL --max-redirs 10 http://example.com | grep -i -E '^(HTTP|location)'Read the location lines. If they swap between http and https, it is an https rule. Between www and the bare domain, it is a hostname rule. The same address over and over usually means the app redirects to itself, often because it believes the visit came in over http.
If curl shows no loop and your browser does, clear the site's cookies or try a private window. Browsers cache 301 redirects, and a cookie can cause a loop for one visitor only.
The usual causes
- A CDN in Flexible SSL mode. Cloudflare's Flexible mode talks to your server over plain http, your server redirects to https, and the CDN asks over http again. Switch to Full or Full (strict), with a valid certificate on the server, or drop the server's own redirect.
- A proxy or load balancer that ends https and talks http to the app. The app sees http and redirects. Pass the scheme on with
proxy_set_header X-Forwarded-Proto $scheme;and have the app read it. - WordPress with
homeandsiteurlon http while the server forces https, or the other way round.wp option get homeandwp option get siteurlshow both; they must match the address you want, scheme included. - Two www rules pointing opposite ways, one in the web server and one in the CDN or the app. Pick one address and keep a single rule for it.
- A redirect plugin or an .htaccess rule that matches its own target. Switch it off and test again.
WordPress behind a proxy
WordPress decides whether a visit is https from what PHP sees. Behind a proxy that ends https, add this near the top of wp-config.php so WordPress takes the proxy's word for it:
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] )
&& strpos( $_SERVER['HTTP_X_FORWARDED_PROTO'], 'https' ) !== false ) {
$_SERVER['HTTPS'] = 'on';
}Add it only when a proxy you control sets that header.
What not to do
- Do not add another redirect to fix a redirect loop.
- Do not turn on HSTS while a loop is live. Browsers then remember the https rule for as long as the header says, often a year.
- Do not test only in your own browser. It has the old redirects cached; curl and a private window show what a new visitor gets.
When to stop and hand it over
Stop if the loop runs through a CDN, a load balancer and the app together, or a panel you did not set up, and each change seems to move the loop somewhere else. Our Server Rescue is one incident at a fixed $69, with a same-day start listed at $109, and nothing to pay if we cannot fix it.
Questions people ask
- Why does it work in one browser and not another?
- Redirects and cookies are cached per browser. Clear the site's cookies, or use a private window, to see what new visitors see.
- Does Cloudflare cause too many redirects?
- Often, in Flexible SSL mode with a server that redirects to https. Cloudflare's own fix is Full or Full (strict) mode with a certificate on the server.
- Does a redirect loop hurt search rankings?
- A page in a loop cannot be crawled, so search engines cannot see it while the loop lasts. Fix the loop and they can crawl it again.
- What does fixing a redirect loop cost?
- With us, Server Rescue at $69 for the incident, or $109 for a same-day start. If we cannot fix it, you pay nothing.
Where each statement comes from
Checked against the sources on .
- Cloudflare: ERR_TOO_MANY_REDIRECTS (developers.cloudflare.com)
- WordPress: HTTPS and reverse proxies (developer.wordpress.org)
- nginx: proxy_set_header (nginx.org)
- curl manual (curl.se)
More server help
- SSL certificate expired: the fix
- Renewing a Let's Encrypt certificate
- Moving a site to a new server
- 403 Forbidden on nginx or Apache
- Server down: what to check first
- 502 Bad Gateway on nginx
- 504 Gateway Timeout
- Error establishing a database connection
- WordPress white screen or critical error
- Disk full: no space left on device
- DNS not resolving or still on the old server
- Email from the server going to spam
- Website hacked: the first steps
- Linux server hardening checklist
- All server help guides
