How to Fix WordPress Redirect Loops
How to resolve How to Fix WordPress Redirect Loops?
Fix WordPress ERR_TOO_MANY_REDIRECTS loops by defining WP_HOME and WP_SITEURL constants with the exact matching HTTPS protocol in wp-config.php, checking Cloudflare SSL encryption mode (set to Full Strict), and auditing .htaccess for circular rewrite rules.
Symptoms & Diagnostic Indicators
Browsers display ERR_TOO_MANY_REDIRECTS or 'The page isn't redirecting properly' when accessing the website.
Common Root Causes
Site URL / Home URL Protocol Mismatch
If siteurl in wp_options uses http:// while the web server enforces https://, WordPress continuously redirects back and forth.
curl -sIL https://example.com/ | grep -E 'HTTP/|Location:'Flexible SSL Gateway Mismatch
Using Cloudflare 'Flexible' SSL mode when the origin server already redirects HTTP to HTTPS causes an infinite redirect loop between edge and origin.
Step-by-Step Fix
Hardcode Canonical URLs in wp-config.php
Add explicit constants in wp-config.php to override database mismatches and break circular redirects.
define('WP_HOME', 'https://example.com');
define('WP_SITEURL', 'https://example.com');Switch Cloudflare SSL to Full (Strict)
In Cloudflare dashboard > SSL/TLS > Overview, switch encryption mode from Flexible to Full (Strict) to ensure end-to-end HTTPS.
Prevention & Verification Checklist
- Ensure origin web server has an active SSL certificate (Let's Encrypt or Cloudflare Origin CA)
- Set WordPress Address and Site Address to identical HTTPS protocols
- Trace redirect paths before deploying site-wide 301 rules
Edge Redirect Protection with Loop Prevention
SearchNexa manages 301 and 302 redirects with automated circular loop detection.
Explore Edge Redirect Engine