How to Fix Redirect Loops (ERR_TOO_MANY_REDIRECTS)

A redirect loop happens when a URL redirects to another URL that eventually redirects back to the first one, so the browser never reaches a page and shows ERR_TOO_MANY_REDIRECTS. By the end of this guide you will have traced every looping URL, found the conflicting rules (usually HTTPS, www or trailing-slash logic set in two places), consolidated them into a single source of truth and confirmed each URL now resolves to a 200 response.

By Updated ⏱ 20-45 minutes🎯 Intermediate● High impactTechnical
Illustration: Redirect loops fix guide
TECHNICAL · FIX GUIDE Redirect loops IMPACTEFFORT TIME20-45 minutes LEVELIntermediate

Why it matters

A looping URL is effectively a dead page. Googlebot stops following after about 10 hops and drops the URL from the index, AI crawlers and link previews get nothing to read, and visitors see a browser error instead of your content. Loops often hit the whole site at once (for example after an SSL or CDN change), so a single misconfiguration can take every page out of search and break checkout or sign-in flows.

This audit fails if even one crawled URL loops.

✕Beforecurl -sIL https://example.com/pricing→ 301 to http://example.com/pricing →301 to https://example.com/pricing → …✓Aftercurl -sIL https://example.com/pricing→ HTTP/2 200 (or at most one 301 tothe canonical URL, then 200)

What you need

The list of looping URLs from the audit report
A terminal with curl, or a browser with DevTools (Network tab)
Access to where redirects are configured: CMS redirect settings, server config (.htaccess / Nginx), and CDN dashboard
Ability to purge server, plugin and CDN caches

Step-by-step fix

1

Trace the redirect chain for each flagged URL

Run curl against every URL the audit flagged and read the Location header of each hop. A loop shows the same two or three URLs repeating until curl gives up. Note exactly what changes between hops: the scheme (http/https), the host (www/non-www), a trailing slash, letter case, or a query parameter.

That difference tells you which rules are fighting.

text
curl -sIL --max-redirs 10 https://example.com/pricing | grep -iE '^(HTTP|location|server|cf-ray)'
Pro tip: Also test the http:// and www variants of the URL. A loop that only appears on one variant points to the host or scheme rule, not the page itself.
2

Identify which layer issues each redirect

Redirects can come from several layers, and loops usually mean two of them disagree. Check response headers to see who answered: server: cloudflare or a cf-ray header means the CDN; x-redirect-by: WordPress or a plugin name means the CMS; a plain server: nginx or Apache with no app headers usually means server config. List every place a redirect can be defined:

  • CDN: Cloudflare Redirect Rules, Page Rules, Always Use HTTPS
  • Hosting panel: force HTTPS / force www toggles
  • Server: .htaccess, Nginx return/rewrite
  • CMS or framework: site URL settings, redirect plugins, middleware
Pro tip: Temporarily pause the CDN (Cloudflare: Overview > Advanced Actions > Pause Cloudflare on Site) and re-run curl. If the loop disappears, the conflict involves the CDN.
3

Fix HTTPS loops caused by a proxy or CDN

The most common loop: the CDN talks to your origin over HTTP, the origin forces HTTPS, and the CDN forwards the request over HTTP again. In Cloudflare set SSL/TLS > Overview to Full (strict) (not Flexible) and install a valid certificate on the origin. If your app sits behind a load balancer, make it trust the X-Forwarded-Proto header so it knows the visitor is already on HTTPS.

apache
# .htaccess: only redirect when neither the connection nor the proxy reports HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^ https://example.com%{REQUEST_URI} [L,R=301]
Pro tip: For WordPress behind a proxy, add to wp-config.php above the 'stop editing' line: if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') { $_SERVER['HTTPS'] = 'on'; }
4

Define the canonical host and scheme in one place

com` without www) and enforce it in a single layer, ideally the web server or CDN. g. "Force www") must be turned off.

Two rules pointing at different canonical hosts is a guaranteed loop.

nginx
server {
    listen 80;
    listen 443 ssl;
    server_name www.example.com;
    return 301 https://example.com$request_uri;
}

server {
    listen 80;
    server_name example.com;
    return 301 https://example.com$request_uri;
}

server {
    listen 443 ssl;
    server_name example.com;
    # site config here, no host/scheme redirects
}
5

Resolve trailing-slash and case conflicts

If hops alternate between /pricing and /pricing/, one rule adds the slash and another removes it. Pick one convention and remove the opposing rule. js trailingSlash, WordPress permalink structure ending in /) combined with a server or CDN rule doing the reverse.

Do the same for lowercase-forcing rules that clash with case-sensitive CMS routes.

nginx
# Nginx: add a trailing slash only for paths without a file extension
rewrite ^([^.]*[^/])$ $1/ permanent;
Pro tip: Only use a slash rule like this if your CMS also generates slashed URLs; otherwise delete it.
6

Remove circular rules in redirect managers

Open your redirect list and search for each looping path as both a source and a target. Delete or edit any pair where A redirects to B and B redirects back to A, and any chain that returns to its starting point (A → B → C → A). Also check that the destination page actually exists and is published; a CMS may redirect an unpublished slug back to an old URL that you have redirected forward.

Pro tip: Point every legacy redirect straight at the final URL. Collapsing chains into single hops prevents future loops when someone adds a new rule.
7

Purge caches and retest every flagged URL

Browsers and CDNs cache 301 responses, so a fixed loop can still appear. Purge the CDN (Cloudflare: Caching > Configuration > Purge Everything), clear any page-cache plugin and server cache, then re-run curl on each URL from the audit plus its http and www variants. Each should end in a 200 after at most one redirect.

Finally, rerun the site audit to confirm zero looping pages.

text
for u in https://example.com/pricing http://example.com/pricing https://www.example.com/pricing; do echo "== $u"; curl -sIL --max-redirs 10 -o /dev/null -w '%{http_code} %{num_redirects} %{url_effective}\n' "$u"; done
Pro tip: Test in a private window. Chrome caches 301s indefinitely, so a normal tab may keep looping even after the server is fixed.

Platform-specific notes

WordPress

Make sure Settings > General > WordPress Address (URL) and Site Address (URL) use the same scheme and host as your server/CDN rules. Check redirect plugins (Redirection: Tools > Redirection; Rank Math: Rank Math > Redirections; Yoast Premium: Yoast SEO > Redirects) for circular entries. If locked out, set WP_HOME and WP_SITEURL in wp-config.php.

Cloudflare

Use SSL/TLS mode Full (strict); Flexible is the classic loop cause when the origin also forces HTTPS. Review Rules > Redirect Rules, Bulk Redirects and any legacy Page Rules for conflicts with server redirects, and avoid enabling Always Use HTTPS while the origin redirects HTTPS to HTTP.

Shopify

Shopify manages HTTPS and the primary domain itself (Settings > Domains). Loops usually come from URL redirects in Online Store > Navigation > View URL redirects (in newer admins under Content > Menus) where a redirect's source is a URL that still exists or targets another redirected path. Delete the conflicting entry; note Shopify only applies redirects for paths that return 404.

Next.js / Vercel

Check redirects() in next.config.js, middleware.ts, and the trailingSlash option together; a middleware that adds a slash while trailingSlash: false removes it will loop. On Vercel, also check the domain settings: if both the www and apex domain are set to redirect to each other under Project > Settings > Domains, you get a loop.

Wix / Squarespace

HTTPS and primary domain are handled by the platform. Loops come from the URL Redirect Manager (Wix: Settings > SEO > URL Redirect Manager; Squarespace: Settings > Developer Tools > URL Mappings) or from a DNS/CDN layer in front of the site forcing a different host than the one set as primary.

Check that it worked

✅ How to verify

  • Run curl -sIL on each previously flagged URL and its http/www variants: every one ends in HTTP 200 with no more than one redirect.
  • Open the URLs in a private browser window with DevTools > Network ('Preserve log' on) and confirm there is no repeating sequence of 301/302 responses.
  • Use Google Search Console URL Inspection > Test Live URL on a key page; it should report the page as fetchable, not a 'Redirect error'.
  • Rerun the site audit and confirm the Redirect loops check reports zero looping pages.

⚠️ Common mistakes

  • Using Cloudflare Flexible SSL while the origin server or CMS also forces HTTPS.
  • Enforcing www/non-www or HTTPS in two places (hosting panel plus .htaccess or CDN) with opposite targets.
  • Testing only in a normal browser tab, where a cached 301 makes a fixed URL still appear to loop, or a cached 200 hides a loop that crawlers still hit.
  • Fixing one hop but leaving a multi-step chain (A → B → C → A) because only direct A ↔ B pairs were checked.

Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.

Check my site free

FAQ

What causes ERR_TOO_MANY_REDIRECTS?

Two or more redirect rules that disagree about the final URL, so each sends the request back to the other. The usual pairs are HTTP vs HTTPS (often a CDN in Flexible SSL mode), www vs non-www, and trailing slash vs no slash, or a redirect plugin entry that points back to its own source.

How many redirects will Google follow before giving up?

Googlebot follows up to 10 redirect hops and then reports a redirect error. A loop never resolves, so the URL is not indexed. Aim for zero or one hop from any internal link to its final URL.

Why does clearing cookies sometimes fix a redirect loop?

Some loops depend on cookies, such as language, region, login or consent redirects that set a cookie and redirect based on it. If clearing cookies fixes it for you, the server logic is still broken for crawlers, which never keep cookies. Make these redirects work without a cookie or remove them for bots.

Can a redirect loop affect my whole site?

Yes. If the loop comes from a host, HTTPS or trailing-slash rule, every URL inherits it and the entire site becomes unreachable. That is why loops often appear right after enabling a CDN, changing SSL settings or switching the primary domain.