How to Fix ERR_TOO_MANY_REDIRECTS in WordPress & Cloudflare
Fix ERR_TOO_MANY_REDIRECTS by matching Cloudflare SSL encryption modes, checking WordPress site URLs, and resolving loop-causing server rewrite rules.
- Published

The browser error ERR_TOO_MANY_REDIRECTS (or “The page isn’t redirecting properly” in Firefox) occurs when an HTTP request enters an endless redirect loop and the browser aborts to prevent resource exhaustion. In WordPress environments using edge proxies like Cloudflare, this is almost always caused by an encryption mode mismatch between Cloudflare’s edge and the origin server.
When Cloudflare connects to your origin web server over unencrypted HTTP while your origin forces an HTTPS redirect, visitor traffic bounces infinitely between port 80 and port 443. Unlike origin refusal errors covered in our Cloudflare Error 521 guide or DNS lookup issues in our DNS change troubleshooting guide, redirect loops generate multiple rapid 301 Moved Permanently or 302 Found responses before terminating.
Quick diagnosis: Tracing the redirect chain
To pinpoint the exact layer creating the bounce, trace the redirect chain using terminal curl:
curl -ILs https://example.com/ | grep -E "^(HTTP/|location:)"
Evaluate the output structure:
- Loop between HTTP and HTTPS: The location alternates continuously between
http://example.com/andhttps://example.com/. This confirms an edge-to-origin SSL mode conflict. - Loop between www and non-www: The location bounces between
https://example.com/andhttps://www.example.com/. This indicates a domain canonicalization mismatch between WordPress settings and DNS/edge rules. - Loop targeting the login page: Requests to
/wp-admin/redirect continuously to/wp-login.php?redirect_to=.... This indicates missing SSL proxy headers (HTTP_X_FORWARDED_PROTO) causing WordPress to falsely believe the visitor is on an unencrypted connection (see our WordPress admin not loading guide for dashboard recovery).
Before you change Cloudflare or server settings
Before modifying configuration files:
- Save a local copy of your current
.htaccessor Nginx server block configuration. - Note your current Cloudflare SSL/TLS encryption setting (Off, Flexible, Full, or Full (strict)).
- Export your current WordPress database
wp_optionstable or note the exactsiteurlandhomerecords. - Prepare an incognito browser window or use
curl; browsers aggressively cache 301 redirects, meaning a solved loop can still appear broken in your regular browser session until local cache is cleared.
Do not toggle multiple edge rules simultaneously without testing after each step; combining multiple untested redirect directives creates complex secondary loops that are difficult to trace.
1. Upgrade Cloudflare SSL/TLS mode from Flexible to Full (strict)
The #1 root cause of ERR_TOO_MANY_REDIRECTS on Cloudflare-proxied WordPress sites is the Flexible SSL mode.
Under Flexible mode:
- The visitor connects to Cloudflare over secure HTTPS (
https://example.com). - Cloudflare decrypts the traffic and forwards the request to your origin web server over plain HTTP (
http://example.com:80). - Your origin server (or WordPress
.htaccess) sees an HTTP request on port 80 and issues an HTTP 301 redirect back tohttps://example.com. - The browser follows the redirect back to Cloudflare, which connects to the origin over HTTP again, creating an infinite loop.
Fix the encryption mode in the Cloudflare Dashboard:
- Log into your Cloudflare dashboard and select your domain.
- In the left navigation, click SSL/TLS.
- Under the Overview tab, examine your current encryption mode.
- If it is set to Flexible, change it to Full or Full (strict).
- Full: Encrypts end-to-end between visitor, Cloudflare, and origin. Accepts self-signed origin certificates.
- Full (strict): Recommended. Requires a valid, unexpired SSL certificate on your origin server (such as a free Let’s Encrypt certificate or a Cloudflare Origin CA certificate).
If your certificate is still generating, review our Cloudflare SSL pending validation guide to ensure validation records are sound. Once Full or Full (strict) is active, retest with curl -ILs https://example.com/.
2. Harmonize WordPress Address and Site Address URLs
If WordPress internal database settings mismatch your public domain format (for example, one is configured with http:// while the site runs on https://, or one includes www while edge rules strip it), WordPress redirects every request to enforce its internal URL.
If you cannot access /wp-admin/ due to the loop, define the canonical URLs explicitly in wp-config.php:
- Access your server via SFTP or SSH.
- Open
wp-config.phpin your root WordPress directory. - Add these two lines above
/* That's all, stop editing! */:
define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com' );
Ensure the protocol (https://) and subdomain structure (www vs non-www) exactly match your desired live address. When defined in wp-config.php, these constants override database records immediately without corrupting serialized data.
3. Handle reverse proxy headers in wp-config.php
When an origin web server sits behind a reverse proxy or load balancer (like Cloudflare, AWS ALB, or an Nginx frontend), SSL terminates at the proxy. The origin receives traffic on internal port 80 or behind a local socket.
If WordPress does not inspect the forwarding header, its internal is_ssl() check evaluates to false, causing WordPress to continuously redirect to HTTPS.
Inform WordPress of the upstream SSL proxy state by adding this snippet to wp-config.php immediately below the opening <?php tag:
// Recognize Cloudflare and reverse proxy HTTPS headers
if ( isset( $_SERVER['HTTP_CF_VISITOR'] ) && strpos( $_SERVER['HTTP_CF_VISITOR'], 'https' ) !== false ) {
$_SERVER['HTTPS'] = 'on';
} elseif ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) {
$_SERVER['HTTPS'] = 'on';
}
This prevents WordPress from issuing redundant HTTPS redirects when the visitor is already connected over HTTPS at the edge.
4. Audit .htaccess and Nginx rewrite rules
Legacy or redundant redirection rules in web server configuration files often fight against edge rules.
For Apache servers, inspect .htaccess in the WordPress root. Restore the clean default WordPress rewrite block:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
If you previously had custom rules forcing HTTPS:
# INCORRECT behind Cloudflare Flexible/Reverse Proxy - Causes Loop
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Remove or comment out this rule, because Cloudflare handles HTTPS enforcement at the edge via Always Use HTTPS.
For Nginx servers, inspect /etc/nginx/sites-available/ and verify that the server block for port 80 redirects cleanly to HTTPS without secondary redirect directives inside the port 443 block:
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
return 301 https://example.com$request_uri;
}
5. Audit Cloudflare Page Rules and Redirect Rules
Conflicting rules inside Cloudflare’s dashboard can redirect traffic into a loop before requests ever hit your origin server.
Inspect your Cloudflare routing logic:
- In Cloudflare, go to Rules > Redirect Rules (and Rules > Page Rules).
- Check for overlapping rules. A classic mistake is having one rule redirecting
example.com/*tohttps://www.example.com/$1while another rule redirects*www.example.com/*back tohttps://example.com/$1. - Check SSL/TLS > Edge Certificates: Ensure Always Use HTTPS is enabled only after your origin supports Full SSL.
- Temporarily disable custom redirect rules one by one to determine if an edge rule is triggering the loop.
6. Clear browser redirect cache and edge CDN cache
Browsers cache 301 Moved Permanently headers aggressively on local disk. Even after you fix the server configuration, your local browser will continue to display ERR_TOO_MANY_REDIRECTS from disk cache.
Clear the cached redirect:
- Open a new Incognito or Private browsing window.
- In Google Chrome, open Developer Tools (F12), go to the Network tab, and check Disable cache (keep DevTools open while testing).
- In Cloudflare, go to Caching > Configuration and click Purge Everything to ensure stale 301 responses are expunged from all edge data centers.
Verify the fix
Confirm that the redirect loop is permanently cleared:
- Execute a terminal curl check:
curl -ILs https://example.com/ | grep -E "^(HTTP/|location:)"
The output should show a single HTTP/2 200 (or at most one single 301 canonical redirect followed by HTTP/2 200):
HTTP/2 200
- Test both the bare domain (
https://example.com) andwwwvariant (https://www.example.com). - Load the
/wp-admin/administration login page and verify that login sessions persist without loop halts. - Check mobile networks and multiple external geographic locations using tools like
https://wheregoes.com/to verify that global edge nodes resolve cleanly.
Rollback and escalation
If the site continues looping after applying these fixes:
- Isolate the origin: In Cloudflare’s Overview tab, scroll down to Advanced Actions and click Pause Cloudflare on Site.
- If the site still loops while Cloudflare is paused, the problem is 100% inside your origin hosting configuration,
.htaccess, or WordPress database. - If the site stops looping while Cloudflare is paused, the issue is strictly inside Cloudflare’s SSL encryption mode or Page/Redirect rules.
- If the site still loops while Cloudflare is paused, the problem is 100% inside your origin hosting configuration,
- Check active security and redirection plugins (such as Really Simple SSL or Redirection). In emergency scenarios, rename
/wp-content/plugins/really-simple-sslvia SFTP to disable plugin-level redirect hooks. - When contacting your hosting support, provide the
curl -ILsresponse trace, your origin server IP, and confirm that SSL encryption mode on Cloudflare is set to Full (strict).
Source and version notes
This guide was verified on October 23, 2026, against Cloudflare SSL/TLS v2 specifications and WordPress 6.7. Diagnostic commands assume standard curl implementations supporting HTTP/2.


