How to Fix the ERR_TOO_MANY_REDIRECTS Error (Apache + Nginx Guide)
What Is ERR_TOO_MANY_REDIRECTS?
This error means your site is stuck in a redirection loop. The browser tried too many times to reach the final destination but never succeeded because it kept being redirected in a cycle.
Browser message example (Chrome):
This page isn’t working. example.com redirected you too many times.
ERR_TOO_MANY_REDIRECTS
Common Causes of Redirect Loops
- Conflicting redirect rules in
.htaccess
(Apache) ornginx.conf
- Improper HTTPS / SSL settings
- Mixed www vs non-www redirects
- Wrong CMS URL settings (WordPress, Joomla, etc.)
- Plugins (especially caching or redirection plugins)
- CDN conflicts, e.g., Cloudflare Flexible SSL
- Server-level redirections from control panels like cPanel or Plesk
Step-by-Step Fixes
1. Clear Browser Cookies and Cache
Sometimes the issue is client-side.
- Clear your browser’s cookies and cache
- Try accessing the site in Incognito Mode
- Or test from another browser/device
2. Check Redirect Chains
Use online tools to inspect redirect behavior:
You’ll be able to detect loops like:https://example.com → http://www.example.com → https://example.com
(infinite)
3. Fix Redirect Rules (Apache / Nginx)
Apache (.htaccess):
Check your .htaccess
file (usually in the web root). Look for multiple or conflicting redirect rules.
Force HTTPS in Apache:
RewriteEngine On RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
Force non-www:
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
Force www:
RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$
https://www.%{HTTP_HOST}/$1 [R=301,L]
Nginx (nginx.conf or site config):
Locate your Nginx config, often found at:
/etc/nginx/nginx.conf
/etc/nginx/sites-enabled/default
- or custom paths
Force HTTPS in Nginx:
server {
listen 80;
server_name example.com
www.example.com;
return 301
https://example.com$request_uri;
}
Force www:
Force non-www:
server {
listen 80;
server_name www.example.com;
return 301 https://example.com$request_uri;
}
Important: Only use one redirect rule. Do not redirect both www → non-www and non-www → www.
After changes:
sudo nginx -t # Test config sudo systemctl reload nginx
4. WordPress URL Mismatches
Login to /wp-admin
, go to:
Settings > General
Ensure the URLs are consistent:
WordPress Address (URL)
Site Address (URL)
Both should be either:
https://example.com
- or
https://www.example.com
If You Can’t Access the Admin:
Edit wp-config.php
:
5. Disable WordPress Plugins
Plugins — especially for SEO, caching, redirection, or security — can cause redirect loops.
How to Disable All Plugins:
If you can’t access the admin dashboard:
- Rename the
wp-content/plugins/
directory toplugins_backup
- Reload your site
Re-enable plugins one-by-one to find the culprit.
6. Fix CDN / Cloudflare Redirect Loops
If you’re using Cloudflare or another CDN, the issue might be in SSL mode.
For Cloudflare Users:
- Go to the SSL/TLS tab
- Set SSL mode to:
Full
(recommended)- Not
Flexible
(causes loops if origin has SSL)
7. Check for Hosting-Level Redirects
If you’ve added redirects via:
- cPanel
- Plesk
- Hosting dashboard
These might conflict with your CMS or server config. Remove or adjust as needed.
8. Reset .htaccess or Nginx Config (if needed)
Reset .htaccess
in WordPress:
# 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
Nginx Example Basic WordPress Block:
Always back up files before changes:
Pro Tips
- Use 301 redirects sparingly — they are cached aggressively.
- After fixing server config, clear browser cache and DNS cache.
- Use browser DevTools → Network tab to monitor the redirect chain live.
Conclusion
The ERR_TOO_MANY_REDIRECTS error can seem intimidating, but once you understand its root causes — such as CMS misconfigurations, SSL issues, or conflicting server rules — it becomes manageable.
With this guide, whether you're on Apache, Nginx, or using a CDN like Cloudflare, you now have the tools to:
- Identify infinite redirect loops
- Fix configuration conflicts
- Safely debug and prevent recurrence