ERR_TOO_MANY_REDIRECTS: Five Causes and Fixes
Why a site gets stuck in a redirect loop: HTTPS behind a CDN, trailing slash rules, WordPress URLs, login cookies and clashing plugins, and how to fix each.

A redirect loop is two or more rules sending a browser around in a circle. Page A says go to B, B says go to A, and the browser keeps following until it reaches its limit. Chrome gives up after 20 redirects and shows a page saying the site "redirected you too many times", with the code ERR_TOO_MANY_REDIRECTS underneath. Firefox and Safari show their own wording for the same failure. Search engines give up sooner: Google follows at most 10 hops.
The good news is that loops have a small number of causes, and each one leaves a recognisable pattern in a trace. This guide covers the five we see most, how to spot each with the free Redirect Checker or curl, and the fix.
To show real output rather than describe it, we rebuilt three of the loops on a local test server and captured what Chrome and curl actually print. That is what Chrome showed for the trailing slash loop described below:
First, confirm it really is a loop
Before changing anything, trace the URL that fails.
With the Redirect Checker. Paste the URL and press Trace Redirects. The checker follows up to 10 hops; when it reaches that limit it stops and flags "too many hops (possible loop)". In a true loop, the URLs in the table repeat. In a merely long chain they do not, which is still a problem but a different one. The screenshot below uses a public test URL that redirects 12 times in a row, to show the warning you will see:
With curl. Limit the hops so the output stays short:
curl -sIL --max-redirs 5 https://example.com/ | grep -iE '^(HTTP|location)'If the same location lines keep repeating and curl ends with Maximum (5) redirects followed, you have a loop. Note which URLs alternate; that pair tells you which two rules are fighting.
In the browser. Open DevTools, choose Network, tick Preserve log and Disable cache, then load the page. The list fills with alternating 3xx rows. If the loop only happens in your browser and not in the checker, cookies or a cached redirect are involved; jump to cause 4.
One shortcut: if the site worked until someone changed an SSL setting, a CDN, a plugin or the site address, start with the cause that matches that change.
Cause 1: HTTPS forced at the CDN or proxy and at the origin
The pattern. The browser asks for https://example.com/ and gets a 301 to https://example.com/: the same URL, over and over.
Why it happens. A CDN or reverse proxy (Cloudflare, a load balancer, a hosting panel's proxy) accepts the visitor's HTTPS connection but talks to your origin server over plain HTTP. The origin sees an HTTP request, and its own "force HTTPS" rule redirects to the https URL. The browser follows, reaches the CDN over HTTPS again, the CDN fetches the origin over HTTP again, and round it goes. In Cloudflare this is the classic result of the Flexible SSL mode combined with an HTTPS redirect on the server (Cloudflare: ERR_TOO_MANY_REDIRECTS).
The mirror image loops too: the CDN redirects HTTP to HTTPS, while the origin, or an old rule in it, redirects HTTPS back to HTTP.
We reproduced the first version with a small proxy in front of a test server that forces HTTPS. This is the top half of the terminal capture below: the same 301 to the same URL, every time.
The fix. Make the origin know the visitor already used HTTPS, then keep one place in charge of the redirect.
- Best: encrypt the hop from the CDN to the origin. In Cloudflare that means SSL mode Full (strict) with a valid certificate on the origin. The origin then sees HTTPS and its redirect rule stays quiet.
- If the proxy must talk HTTP: have the origin trust the
X-Forwarded-Protoheader that the proxy sets, and only redirect when it sayshttp. In our test, the same server with that one change answered200at once. - Or: remove the HTTPS redirect from one side, so only the CDN or only the origin does it.
Once fixed, check that the certificate the visitor sees is valid for every host with the SSL Checker.
Cause 2: trailing slash rules fighting each other
The pattern. /shop redirects to /shop/, and /shop/ redirects to /shop.
Why it happens. Two layers have different opinions about slashes. The web server may add a slash to anything that looks like a directory (Apache's mod_dir does this by default), while the application, an SEO plugin or a rewrite rule strips slashes from every URL. Each rule is correct for its own owner. Together they loop. The Chrome error at the top of this page came from exactly this pair of rules on our test server.
How to confirm. The trace alternates between two URLs that differ only by the final /.
The fix. Decide which form is canonical for your site and remove or narrow the other rule. If the application generates URLs without slashes, turn off the server's automatic directory slash for those paths (in Apache, DirectorySlash Off inside the right <Directory> or <Location>, only if no real directory needs it), or make the stripping rule skip real directories. Then trace both forms of a few URLs: each should reach the canonical form in one hop.
Cause 3: WordPress site address mismatch
The pattern. The loop is between two hosts or two schemes: example.com and www.example.com, or http and https. The site is WordPress, and it often started right after a move, a domain change or an SSL install.
Why it happens. WordPress stores two addresses in its settings: the WordPress Address (siteurl) and the Site Address (home). It redirects requests to the host and scheme in home. If those say https://example.com while the server or host panel redirects every bare domain request to https://www.example.com, WordPress sends the visitor back and the server sends them forward again.
A second WordPress variant looks like cause 1. Behind a proxy or CDN that ends HTTPS and talks HTTP to the server, WordPress believes the request is plain HTTP and redirects to the https address in its settings, forever.
The fix.
- Make
homeandsiteurlmatch the final URL your server redirects to, scheme and host included. If you cannot reach the admin screen because of the loop, set them inwp-config.php, above the line that says to stop editing:
define( 'WP_HOME', 'https://www.example.com' );
define( 'WP_SITEURL', 'https://www.example.com' );- Or, with shell access, use WP-CLI:
wp option update home 'https://www.example.com'and the same forsiteurl. - Behind a proxy that sends
X-Forwarded-Proto, tell WordPress the request was HTTPS. The WordPress documentation suggests a check like this inwp-config.php(WordPress: HTTPS for WordPress):
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) {
$_SERVER['HTTPS'] = 'on';
}Only trust that header when every request really comes through your proxy; otherwise anyone can send it.
Cause 4: cookie and login loops
The pattern. A protected page redirects to the login page, and the login page redirects straight back, often with a Set-Cookie header in between. It may happen for one browser only, or only after signing in.
Why it happens. The application sets a session cookie and redirects to the protected page, but the browser never sends the cookie back. Common reasons:
- the cookie's
Domaindoes not match the host (set forexample.comwhile the site runs onwww.example.co.in, or for the wrong subdomain), - the cookie is marked
Securebut the site is served over plain HTTP, so the browser refuses to store it, SameSitesettings block the cookie on a cross site sign-in flow,- a stale or corrupted cookie that the server rejects every time.
The bottom half of the terminal capture above is a reproduction: the login page sets a cookie for a domain that does not match the server, curl's cookie jar correctly refuses it, and the server keeps sending it back to log in.
How to confirm. In DevTools, open the redirect responses and look at the Set-Cookie header. Chrome highlights a blocked cookie in that request's Cookies tab, and Application then Cookies shows whether it was stored. Chrome's error page suggests deleting cookies for a reason: if a private window loads the page fine, a stored cookie is part of the problem.
The fix. Correct the cookie attributes in the application: a Domain that matches the real host (or no Domain at all, which scopes it to the exact host), Secure only on an HTTPS site, and a SameSite value that suits your sign-in flow. If only some visitors loop, a cookie from an older version of the site may need clearing; changing the cookie name in the application does that for everyone.
The Redirect Checker sends no cookies, so it shows what a signed out visitor gets. That is useful for this cause: if the checker shows a clean chain to the login page and your browser loops, the problem is in the stored cookie, not in the redirect rules.
Cause 5: plugin and server rules that disagree
The pattern. Any of the patterns above, on a site where redirects are configured in more than one place.
Why it happens. Redirects can live in a CDN dashboard, the hosting panel, the web server config, .htaccess, the CMS settings and one or more redirect or SSL plugins. When two of them set the same thing differently, such as a host panel that strips www while an SEO plugin adds it, or an SSL plugin forcing HTTPS on top of a server rule that already does, they loop or at best form a long chain. This often appears after a plugin update, a host migration or someone "fixing" a redirect in the place they happen to have access to.
How to confirm. Turn rules off one layer at a time and trace after each change. Start with plugins, because they are the easiest to disable: on WordPress, rename the plugin's folder over SFTP if you cannot reach the admin screen. Then check .htaccess, the vhost, the hosting panel and the CDN page rules. The HTTP Header Checker helps here: headers such as Server, X-Redirect-By (which WordPress and some plugins add) or a CDN's own headers often show which layer sent a redirect.
The fix. Pick one owner for each decision and write it down: one place forces HTTPS, one place picks www or not, one place handles moved pages. Remove the duplicates everywhere else.
After the fix
- Trace the failing URL again in the Redirect Checker and in curl. It should reach a
200in one hop, or two for a deliberate HSTS setup. - Trace the variants: http and https, with and without www, with and without the trailing slash.
- Test in a private browser window, then in your normal one with the cache disabled. Browsers cache 301 and 308 responses, so a fixed server can still loop for someone who cached the old answer; clearing the site's data in that browser resolves it.
- Run the Website Health Checker to confirm SSL, headers and the redirect chain together.
For the method behind these traces, see how to check a redirect chain. If the loop started when someone changed a redirect from one code to another, 301 vs 302 redirects explains which code each rule should use. And if the rules turn out to be spread across a CDN, a host panel and three plugins, that is a common job for our website fixes service: measured, fixed at a fixed price, then checked again.
Tools mentioned in this post
- Redirect CheckerTest any URL’s redirects: every hop’s status code, Location and time, with loops and wasted hops called out.
- HTTP Header CheckerInspect any URL’s response headers and get a security-header report card.
- Website Health CheckerOne scored report: uptime, SSL, DNS, speed, redirects, security headers, SPF and DMARC.
- SSL CheckerCheck any site’s SSL certificate: validity, expiry date, issuer and chain.


