ERR_TOO_MANY_REDIRECTS: .htaccess HTTPS rules behind Cloudflare

By ToolsRacks Editorial Team · SEO & Web Tools · 2 min read ·

Why a normal HTTPS redirect loops behind Cloudflare Flexible SSL — and how to fix it with Full mode or a proxy-aware .htaccess rule.

Chrome’s ERR_TOO_MANY_REDIRECTS means the browser followed a chain of redirects that never settled on a final URL. Behind Cloudflare (or another CDN that terminates HTTPS), the most common cause on Apache sites is an .htaccess rule that redirects every HTTP request to HTTPS — while Cloudflare is still talking to your origin over plain HTTP. Use the free .htaccess redirect generator to build a proxy-aware HTTPS rule once you know which fix applies.

What is actually looping

  1. The visitor opens https://example.com. Cloudflare accepts HTTPS.
  2. In Flexible SSL mode, Cloudflare fetches your origin as http://.
  3. Your .htaccess sees HTTP, redirects to HTTPS.
  4. Cloudflare fetches HTTP again → redirect again → the browser gives up.

Cloudflare’s own troubleshooting for this error recommends either removing the origin HTTPS redirect or switching the SSL/TLS mode to Full (or Full strict) so Cloudflare talks HTTPS to a certificate on your server. Confirm the certificate with the SSL checker after you change mode.

Fix option A — preferred

In Cloudflare: SSL/TLS → Overview → Full (or Full strict if the origin certificate is publicly trusted). Keep a single HTTPS redirect at the edge or on the origin, not both fighting each other.

Fix option B — proxy-aware .htaccess

If you must keep an origin redirect while a proxy terminates TLS, the rule must also look at X-Forwarded-Proto (the protocol the visitor used). The ToolsRacks .htaccess redirect generator has a Cloudflare / CDN (proxy) option under Quick redirects that emits that condition for you.

Conceptually the safe pattern is: redirect only when HTTPS is off and the forwarded proto is not already https. A rule that redirects whenever %{HTTPS} is off, with no proxy check, will loop in Flexible mode.

Other loops to check

  • www ↔ non-www rules that bounce both ways.
  • HTTP→HTTPS plus a host redirect that points back at the HTTP host.
  • A CMS or plugin redirect on top of an identical .htaccess rule.

Build the canonical host and HTTPS rules once with the .htaccess redirect generator, paste into your site’s root .htaccess, purge Cloudflare cache, and re-test in a private window.

Try the tools from this guide

Free, no signup — open one and apply what you just read.

Sources and further reading

Written for ToolsRacks by the ToolsRacks Editorial Team. Spotted a mistake or something out of date? Tell us and we will correct it — see our editorial standards.