Fix “Too Many Redirects” Error with Cloudflare and WordPress
If you use WordPress and Cloudflare together, you may see an error that says “Too many redirects.” This usually means that your website is stuck in a loop between HTTP and HTTPS.
Don’t worry, this is a common problem and easy to fix.
Step 1: Set the Correct SSL Mode in Cloudflare
Go to your Cloudflare dashboard and select your website. Click on the SSL/TLS tab. Make sure the SSL mode is set to: Full or Full (Strict)
Do not use Flexible. This is the main reason why the redirect loop happens.
Step 2: Update WordPress Config
Open your WordPress wp-config.php file. You can do this with an FTP client or by using SSH.
Add this code near the top of the file:
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
$_SERVER['HTTPS'] = 'on';
}
This tells WordPress that the site is using HTTPS, even if Cloudflare is in front of it.
Step 3: Clear Cache
After making changes:
- Clear your Cloudflare cache
- Clear your browser cache
- Clear your WordPress cache plugin if you use one
Done
Now try to visit your website again. It should work fine without the redirect error.
If the problem is still there, double-check your .htaccess file or SSL settings on your server.
Tip: Always make a backup before editing files.
Let me know in the comments if this helped you or if you need more help.
Leave a Reply