How to Fix the ERR_TOO_MANY_REDIRECTS Error (Apache + Nginx Guide)
This guide helps you diagnose and fix issues on Apache, Nginx, Cloudflare, or CMS platforms like WordPress
Introduction
The ERR_TOO_MANY_REDIRECTS error occurs when a website keeps redirecting between URLs endlessly, creating a loop that the browser can’t escape. It's a common issue for websites using WordPress, CMS platforms, reverse proxies, or SSL configurations — especially with Apache or Nginx servers.
This guide covers everything you need to diagnose and fix the issue — whether you're using Apache or Nginx, Cloudflare, or a CMS like WordPress.
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.confImproper 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
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
Check Redirect Chains
Use online tools to inspect redirect behavior:
https://kawigraphics.com/redirect-checker
You’ll be able to detect loops like:
https://example.com → http://www.example.com → https://example.com(infinite)
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 (apache):
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]Force www (apache):
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/defaultor 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 (nginx):
server {
listen 80;
server_name example.com;
return 301 https://www.example.com$request_uri;
}
Force non-www (nginx):
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 nginxWordPress 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.comor
https://www.example.com
If You Can’t Access the Admin:
Edit wp-config.php:
define('WP_HOME','https://example.com');
define('WP_SITEURL','https://example.com');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_backupReload your site
Re-enable plugins one-by-one to find the culprit.
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)
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.
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 WordPressNginx Example Basic WordPress Block:
location / {
try_files $uri $uri/ /index.php?$args;
}Always back up files before changes:
sudo cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.backupPro 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
Emphasize your Creative Expertise
-
Top Features to Look for in a Hosting Provider for Small Businesses
Small businesses need hosting providers with affordability, reliability, security, and scalability to succeed online
-
How to Set Up a Secure and Reliable Web Server on Ubuntu
Setting up a secure and reliable web server on Ubuntu is crucial for protecting your data and ensuring high availability. This guide walks you through the process
-
Beware of Typosquatting
A major threat businesses face is typosquatting—deceptive domains tricking users, stealing trust, and damaging brand reputations