Skip to main content
DigiCert, Sectigo and GeoTrust SSL certificates
+90 850 259 76 06 WhatsApp Support Become a Reseller
SSL Certificates
Brands
Code Signing LEI Code
Tools
Support Contact WhatsApp Cart
Language
Currency
Get an SSL Certificate
SSL Security

ERR_TOO_MANY_REDIRECTS: SSL Redirect Loop Error and Solution

Causes of ERR_TOO_MANY_REDIRECTS redirect loop error after SSL installation. Redirect loop solution in Cloudflare, Nginx, Apache and WordPress.

9 min read

What is ERR_TOO_MANY_REDIRECTS?

The

ERR_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:

  1. Server: HTTP → HTTPS redirect → https://example.com
  2. CDN/Proxy: HTTPS → forwards to origin as HTTP
  3. Server: HTTP → HTTPS redirect → https://example.com
  4. ... 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.

Share this post
Ali Yiğit
Yazar

Ali Yiğit

Recommended SSL Certificates

All Products
EV Certum

Certum Premium EV Multi-Domain SSL

Protect multiple domains at EV level with Certum Premium EV Multi-Domain SSL. Company name visible i

$419.00 /yr
Details
EV Certum

Certum Premium EV SSL

Get the most comprehensive identity validation with Certum Premium EV SSL. Extended validation, comp

$654.58 /yr
Details
OV Certum

Certum Trusted Multi-Domain SSL

Protect multiple domains at OV level with Certum Trusted Multi-Domain SSL. Company name visible, 4,

$50.00 /yr
Details