If you’ve ever encountered a frustrating error message stating Too Many Redirects ERR_TOO_MANY_REDIRECTS
or This page has a redirect loop
, you’re dealing with a common but troublesome web browsing issue. This comprehensive guide will help you understand what causes this error and provide practical solutions to fix it.
A redirect loop occurs when a web server keeps sending your browser back and forth between URLs with no resolution. Here’s exactly what happens:
/blog
)/blog/new
)After approximately 20 redirects, your browser detects this infinite pattern and breaks the cycle, displaying the ERR_TOO_MANY_REDIRECTS
error to prevent your browser from being trapped in an endless loop.
What is the Too Many Redirects
Error?
This error occurs when a web page is caught in an endless redirection loop between different URLs with no final destination.
ERR_TOO_MANY_REDIRECTS
, Firefox displays “The page isn’t redirecting properly”, Safari shows Too many redirects occurred
.Common Causes:
How to Fix It?
For Website Visitors:
For Website Owners:
A Too Many Redirects
error occurs when a web page gets caught in an endless redirection loop. Instead of landing on your desired webpage, your browser detects that it’s being sent in circles between different URLs with no final destination.
Different browsers display this error in various ways:
ERR_TOO_MANY_REDIRECTS
or This webpage has a redirect loop
The page isn't redirecting properly
Too many redirects occurred trying to open [URL]
This page isn't working right now
Regardless of the wording, the core issue remains the same: your browser has detected a circular redirection pattern and stopped the process to prevent an infinite loop.
One of the most common causes is misconfigured redirect rules in your website’s configuration files, such as .htaccess
for Apache servers or nginx.conf
for Nginx servers. For example:
If you’re using a content management system (CMS) like WordPress, conflicting plugins that handle URL redirects can create redirection loops. This often happens when:
When implementing SSL certificates and HTTPS, improper configuration can lead to redirect loops, especially if:
Sometimes cookies can cause redirect loops, particularly when:
Before implementing solutions, it’s important to identify the exact cause of your redirect loop:
Open your browser’s developer tools (F12 or right-click and select “Inspect”), navigate to the Network tab, and attempt to access the problematic URL. Look for a pattern of 301 or 302 HTTP status codes that form a loop.
Examine your web server’s access and error logs to trace the redirection path. Look for patterns of repeated redirects between the same set of URLs.
Determine if the issue is browser-specific or affects all users by testing in different browsers, devices, and network environments.
Online tools like httpstatus.io or HTTP Status Checker can help visualize redirect chains and identify where loops occur.
If you’re encountering this error while browsing a website:
This is often the simplest solution, as corrupted cookies are a common cause:
For Other Browser
Open the problematic website in an incognito or private browsing window to check if the issue is related to your browser profile.
Temporarily disable browser extensions, especially those related to security, ad-blocking, or content modification, as they might interfere with website redirections.
If the error persists, try accessing the website from a different browser to determine if it’s a browser-specific issue.
Ensure your device’s time and date settings are correct, as authentication systems sometimes use these for cookie validation.
If you’re experiencing this error on your own website, here’s a comprehensive approach to resolving the issue:
Misconfigured redirect rules are the most common cause of redirect loops. Examine your website’s configuration files carefully:
For Apache (.htaccess):
Redirect
, RedirectMatch
, or RewriteRule
directivesRewriteRule ^support$ /help [R=301,L]
RewriteRule ^help$ /support [R=301,L]
For Nginx:
location
blocks with return
or rewrite
directives# Safe way to redirect HTTP to HTTPS
server {
listen 80;
server_name example.com;
location / {
# Only redirect if not already on HTTPS
if ($http_x_forwarded_proto != "https") {
return 301 https://$host$request_uri;
}
}
}
For IIS:
Plugin conflicts are especially common in WordPress and other CMS platforms:
Systematic debugging approach:
Common problematic plugin combinations:
Specific plugin settings to check:
SSL misconfiguration is a frequent source of redirect loops:
Verify certificate installation:
Resolve mixed content issues:
grep -r "http://" --include="*.php" --include="*.html" /path/to/your/website
Check load balancer configuration:
curl -I https://pinggy.io -H "X-Forwarded-Proto: https"
Many content management systems have built-in settings that can cause redirect loops:
WordPress:
WP_HOME
and WP_SITEURL
constants in wp-config.phpwp_options
table for inconsistent URL valuesdefine('WP_HOME', 'https://example.com');
define('WP_SITEURL', 'https://example.com');
Drupal:
$settings['trusted_host_patterns'] = [
'^example\.com$',
'^www\.example\.com$',
];
Joomla:
Modern hosting architectures with CDNs and load balancers introduce additional complexity:
Cloudflare configuration:
AWS Configuration:
aws elbv2 describe-rules --listener-arn your-listener-arn
Custom proxy setups:
proxy_set_header X-Forwarded-Proto $scheme;
Set up detailed logging to diagnose complex redirect issues:
HTTP request logging:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
Application-level logging:
error_log(sprintf(
"Redirect triggered: From %s to %s (User Agent: %s, Referrer: %s)",
$_SERVER['REQUEST_URI'],
$redirectUrl,
$_SERVER['HTTP_USER_AGENT'],
$_SERVER['HTTP_REFERER'] ?? 'none'
));
By systematically working through these detailed steps, you’ll be able to identify and resolve even the most complex redirect loop issues on your website. Remember to test each change thoroughly and to keep a backup of your original configuration in case you need to revert changes.
The command-line tool cURL can help identify redirect chains:
curl -IL https://pinggy.io
This will show all redirect hops with their status codes and headers.
Tools like Wireshark or Fiddler can provide detailed insights into HTTP traffic, helping identify complex redirect patterns.
Implementing temporary logging in your server-side code can help track the logic that triggers redirects:
// PHP example
error_log('Redirect triggered from: ' . $_SERVER['REQUEST_URI'] . ' to: ' . $destination);
Test thoroughly before deploying: Use staging environments to test redirect rules before applying them to production.
Implement redirect limits: Configure your application to limit the number of consecutive redirects.
Document your redirect strategy: Maintain clear documentation of all redirect rules and their purposes.
Use monitoring tools: Implement tools that can alert you if redirect chains exceed a certain length.
Regular audits: Periodically review your website’s redirect rules to identify and eliminate unnecessary or problematic redirections.
// Add to wp-config.php to help diagnose redirect issues
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
Check that your site URL settings in Settings → General are correct and consistent.
# Proper way to redirect HTTP to HTTPS without causing loops
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Proper HTTPS redirect for Nginx
server {
listen 80;
server_name example.com www.example.com;
# Avoid loops by checking X-Forwarded-Proto
if ($http_x_forwarded_proto != "https") {
return 301 https://$host$request_uri;
}
# Rest of your configuration
}
The Too Many Redirects
error, while frustrating, is usually fixable once you understand its cause. By systematically checking your browser settings, website configuration, and redirection rules, you can identify and resolve the circular redirections causing the problem.
Remember that this error is ultimately a safety mechanism—your browser is protecting you from an infinite loop that would otherwise crash your browsing session. With the troubleshooting steps outlined in this guide, you should be able to diagnose and fix redirect loops, whether you’re a website visitor or administrator.
If you continue to experience issues after trying these solutions, consider reaching out to your website host’s support team or consulting with a web developer who specializes in server configurations and redirects.