All posts

Blog

How to Fix ERR_TOO_MANY_REDIRECTS (Redirect Loop) on Your Website

Illustrated cover for the Troubleshooting guide "How to Fix ERR_TOO_MANY_REDIRECTS (Redirect Loop) on Your Website"

Few errors are as confusing as this one. You visit your own website and the browser gives up with a message like "This page isn't working – example.com redirected you too many times," along with the code ERR_TOO_MANY_REDIRECTS. Firefox calls it "The page isn't redirecting properly," and Safari says "Too many redirects occurred."

The good news: this error almost always comes from a settings conflict rather than broken files or a hacked site. Once you know where redirects come from, you can usually track down the loop in a few minutes.

What a redirect loop actually is

A redirect tells the browser, "the page you want is over there." That's normal. Sites redirect http:// to https://, or example.com to www.example.com, all the time.

A loop happens when two rules disagree. For example:

  1. Rule A sends http://example.com to https://example.com.
  2. Rule B sends https://example.com back to http://example.com.

The browser bounces between them until it hits its limit (usually around 20 redirects) and stops with an error. The key to fixing it is finding which two rules are fighting.

Step 1: Rule out your browser

Old cookies or a cached redirect can keep the error showing even after the real problem is fixed.

  • Open the site in a private or incognito window.
  • Try a different browser or your phone on mobile data.
  • Clear cookies for the site specifically.

If the site loads fine in private mode, clear your cache and cookies and you're done. If it fails everywhere, keep going.

Step 2: Watch the redirect chain

Seeing the actual chain of redirects tells you exactly where the loop is. Use an online redirect checker, or run this in a terminal:

curl -I -L --max-redirs 10 http://example.com

Look at each Location: header. You'll typically see a pattern such as http → https → http, or www → non-www → www. That pattern points you to the cause.

The most common causes (and fixes)

1. CDN or proxy SSL set to "Flexible"

This is the classic cause. If your site sits behind a proxy or CDN such as Cloudflare with SSL set to Flexible, visitors connect to the CDN over HTTPS, but the CDN connects to your server over plain HTTP. If your server or app forces HTTPS, it sees an HTTP request and redirects to HTTPS. The CDN passes that back, the browser asks again, and the loop begins.

Fix: Make sure your hosting server has a valid SSL certificate (most hosts issue one free), then change the CDN's SSL mode to Full or, ideally, Full (strict). Also check that you don't have both the CDN's "Always Use HTTPS" feature and conflicting server rules pointing different ways.

2. WordPress URL settings don't match

WordPress stores two addresses: WordPress Address (URL) and Site Address (URL). If these say http:// while your server forces https://, or one includes www while the other doesn't, you can get a loop.

Fix: If you can reach the dashboard, go to Settings > General and make both URLs identical, including https:// and the www choice. If you can't log in, add these lines to wp-config.php above the "That's all, stop editing" line:

define('WP_HOME', 'https://example.com');
define('WP_SITEURL', 'https://example.com');

You can also edit the siteurl and home rows in the wp_options table with phpMyAdmin.

3. Conflicting .htaccess rules

On Apache and LiteSpeed servers, redirect rules often live in the .htaccess file in your site's root folder. Plugins, old migrations and copy-pasted snippets can leave duplicate or contradictory rules, like one forcing www and another removing it.

Fix: Download a backup copy of .htaccess, then look for RewriteRule and Redirect lines. Remove duplicates and keep one clear set of rules. For a WordPress site, you can temporarily replace the file with the default WordPress rules to test. Our guide to fixing WordPress 404 errors and .htaccess shows the default version.

4. Hosting panel redirects

cPanel's Redirects tool and DirectAdmin's redirect and "Force SSL" options add rules too. If you also redirect in .htaccess, a plugin, or a CDN, they can clash.

Fix: Pick one place to handle each redirect. For example, force HTTPS in the hosting panel only, and remove the same rule elsewhere.

5. Redirect or SSL plugins

WordPress plugins that force HTTPS, manage redirects, or handle caching can create loops, especially after a migration or a domain change.

Fix: Rename the wp-content/plugins folder (or just the suspect plugin's folder) using File Manager or FTP. This disables plugins. If the site loads, rename it back and reactivate plugins one at a time to find the culprit.

6. A cached redirect in a caching layer

Server-side or plugin caches can store a redirect response. After you fix the real rule, the cache may keep serving the loop.

Fix: Purge your caching plugin, your server cache (such as LiteSpeed Cache), and your CDN cache after every change.

7. Login or cookie loops

Sometimes only the login page loops, sending you back to the login screen over and over. This is often a cookie domain or URL mismatch, or a security plugin.

Fix: Clear cookies, confirm the site URLs match as above, and temporarily disable security or login plugins.

A quick troubleshooting order

If you're not sure where to start, work through these in order:

  1. Private window test
  2. Check the redirect chain with curl or an online tool
  3. CDN SSL mode (set to Full or Full strict)
  4. WordPress URL settings
  5. .htaccess rules
  6. Hosting panel redirects and Force HTTPS settings
  7. Plugins
  8. Purge all caches

Change one thing at a time and test after each step, so you know which change fixed it.

How to prevent redirect loops

  • Handle each redirect (HTTPS, www) in one place only.
  • Keep a note of where your redirects are configured.
  • After a migration or SSL change, test both http:// and https://, with and without www.
  • Keep a backup of .htaccess before editing it.

For more on doing redirects the right way, see 301 redirects and SEO, and for background on HTTPS, read what is an SSL certificate.

Wrapping up

ERR_TOO_MANY_REDIRECTS looks alarming, but it's simply two rules disagreeing about where your page should live. Trace the redirect chain, check your CDN SSL mode and site URLs, clean up duplicate rules, and purge your caches. In most cases, your site will be back within minutes.