What is ERR_TOO_MANY_REDIRECTS?
TheERR_TOO_MANY_REDIRECTS error occurs when the browser enters an indefinite redirect loop for a page. The browser usually puts an upper limit after 20 redirects, breaks the loop, and displays this error.
This error is very common after SSL installation because an infinite loop can occur when the HTTP → HTTPS redirect and the cascades between the server/CDN/application are not configured correctly.
Typical Redirect Loop Scenario
User visits http://example.com:
- Server: HTTP → HTTPS redirect →
https://example.com - CDN/Proxy: HTTPS → forwards to origin as HTTP
- Server: HTTP → HTTPS redirect →
https://example.com - ... infinite loop
Cause 1: Cloudflare SSL Mode Wrong
The most common reason. If Cloudflare SSL mode is "Flexible", HTTPS is used between Cloudflare and the visitor, but Cloudflare connects to the origin server via HTTP. If there is HTTP→HTTPS redirection on the server, a loop occurs.
Solution
- Set Cloudflare SSL mode to "Full" or "Full (Strict)"
- Full: Any SSL certificate (including self-signed) on Origin is sufficient
- Full (Strict): A valid SSL certificate is required in Origin (recommended)
Change Cloudflare Dashboard → SSL/TLS → Overview → SSL information mode.
Cause 2: Conflicting Rules in Nginx/Apache
There may be a conflict if there are redirect rules in both the server block and the .htaccess file.
Nginx Solution
# FALSE: Looping in the same server block
server {
listen 443 ssl;
server_name example.com;
# This rule is triggered even when on HTTPS!
if ($scheme = "http") {
return 301 https://$host$request_uri;
}
}
# TRUE: Separate server blocks
server {
listen 80;
server_name example.com www.example.com;
return 301 https://www.example.com$request_uri;
}
server {
listen 443 ssl;
server_name example.com www.example.com;
# ... SSL configuration
}
Apache Solution
# FALSE: Rule that creates a loop
RewriteEngine On
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# TRUE: HTTPS check added
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# OR: X-Forwarded-Proto control (behind proxy/CDN)
RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Cause 3: WordPress Site URL Problem
If "Site URL" and "WordPress URL" are set to HTTP in WordPress, WordPress redirects itself to HTTP.
Solution
# add to wp-config.php file
define('WP_HOME', 'https://www.example.com');
define('WP_SITEURL', 'https://www.example.com');
# Or update in database
UPDATE wp_options SET option_value = 'https://www.example.com' WHERE option_name = 'siteurl';
UPDATE wp_options SET option_value = 'https://www.example.com' WHERE option_name = 'home';
Cause 4: Load Balancer or Reverse Proxy
When the load balancer terminates SSL and forwards it to the backend via HTTP, the backend server redirects thinking it is not on HTTPS.
Solution
# Nginx: Check header from proxy
set $redirect_https 0;
if ($scheme = "http") { set $redirect_https 1; }
if ($http_x_forwarded_proto = "https") { set $redirect_https 0; }
if ($redirect_https = 1) { return 301 https://$host$request_uri; }
# Apache: X-Forwarded-Proto control
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Debugging: Seeing the Redirect Chain
# Follow redirect chain with curl
curl -vL http://example.com 2>&1 | grep -i "location:"
# Or use httpstas.io (web tool)
# Shows the redirect and HTTP codes at each step
Conclusion
ERR_TOO_MANY_REDIRECTS error is usually caused by a mismatch between the CDN/proxy SSL mode and the server routing rules. If you are using Cloudflare, "Full (Strict)" SSL mode, otherwise checking the X-Forwarded-Proto header will solve the problem. You can quickly detect the problematic step by monitoring the redirect chain with the curl command.