Technical SEO

Redirect chains and loops: why they hurt and how to fix them

Redirect chains are redirects that land on another redirect; fix them by pointing every old URL straight at the final page in one hop and linking to that final URL yourself. Loops, where a hop points back to an earlier URL, make the page unreachable and need fixing first. Lighthouse fails pages with two or more redirects.

What is a redirect chain, and what is a redirect loop?

A redirect chain is any path where one redirect lands on a URL that redirects again. A visitor asks for http://example.com/blog/post, gets sent to https://example.com/blog/post, then to https://www.example.com/blog/post, then to https://www.example.com/blog/post/. Three hops before a single byte of the page arrives. Nobody planned that chain. Each rule made sense when someone added it.

A redirect loop is a chain that never ends because a later hop points back at an earlier URL. /a sends you to /b, and /b sends you back to /a. Browsers give up after a fixed number of attempts and show an error instead of the page. In Chrome that is ERR_TOO_MANY_REDIRECTS; Firefox says the page isn't redirecting properly. A loop is an outage for that URL. A chain is a slow, leaky path that still works.

That difference sets your priority. Fix loops the same day, because the page is unreachable for people and for crawlers. Fix chains in your next maintenance pass, starting with the ones your own links and sitemap send traffic into.

Do redirect chains hurt SEO and page speed?

They cost speed for certain, and they make Google's job harder. Chrome's Lighthouse documentation on avoiding multiple page redirects says a page fails that audit when it has two or more redirects, and that each extra trip across the network can delay loading by hundreds of milliseconds. As of Lighthouse 13, that check lives inside the Document request latency insight, so look there if you can't find the old audit name in a recent report.

On the search side, Google's guide to redirects and Google Search explains that it uses certain redirects as a signal that the target should be the canonical URL. A permanent redirect tells Google to show the target in results; a temporary one tells it to keep showing the source. A chain that mixes the two sends mixed signals: if hop one is a 302 and hop two is a 301, you have asked Google to keep the old URL and to replace the middle one at the same time.

What a chain does not do is wipe out a page overnight. Google follows redirects, and a two hop chain on an old URL that gets a few visits a month is a low priority. The real costs are slower first loads for every visitor who takes the long path, wasted fetches on large sites, and the growing chance that one link in a long chain breaks and turns the whole path into a 404. No redirect fix will move rankings on its own, so treat this as hygiene, not a growth tactic.

Which redirect status codes should you use?

Pick the code by one question: is this move permanent? Google's redirects guide sorts the options like this, and it is the table to keep open while you clean up.

Redirect typeGoogle treats it asUse it when
HTTP 301 (Moved Permanently)PermanentA page or site moved for good. The default on Netlify.
HTTP 308 (Permanent Redirect)PermanentSame as 301, but the request method is kept. The default for permanent redirects on Vercel.
Meta refresh or HTTP refresh at 0 secondsPermanentYou cannot set server redirects at all.
JavaScript location changePermanentLast resort; Google says only use it if server side and meta refresh are not possible.
HTTP 302 (Found) or 307 (Temporary Redirect)TemporaryA short term move you plan to undo, such as a sale page.
HTTP 303 (See Other)TemporarySending a browser to a result page after a form post.
Meta refresh with a delay over 0 secondsTemporaryRarely a good idea; avoid for moved content.

Source: Google Search Central, Redirects and Google Search, checked November 2026.

Google's own wording is to use permanent redirects when you are sure the redirect won't be reverted. For cleanup work that is almost always the case, so every rule you rewrite while flattening chains should usually end up as a 301 or 308 pointing at a URL that returns 200.

How do you find redirect chains on your site?

Start with the URLs that matter most: every URL in your sitemap, every internal link, and the old URLs you know still get traffic from other sites. Then trace each one hop by hop. A single command shows the hop count for one URL:

curl -sL -o /dev/null -w '%{num_redirects} hops, ends at %{url_effective} (%{http_code})\n' https://example.com/old-page

Anything above 1 is a chain. Add --max-redirs 10 to stop at a loop: curl then exits with code 47, which is how you tell a loop from a long chain in a shell script.

For a list of URLs, this standard library Python script prints each hop with its status code and flags chains and loops. It sends a GET per hop and does not follow redirects automatically, so you see every step instead of only the end. It was tested in November 2026 against a local server serving a two hop chain, a loop, a relative Location header and a clean 200.

#!/usr/bin/env python3
"""Trace every redirect hop for each URL, one request at a time.

Usage: python3 trace_redirects.py urls.txt   (one URL per line)
       python3 trace_redirects.py https://example.com/old-page
"""
import sys
import http.client
from urllib.parse import urlsplit, urljoin

MAX_HOPS = 15

def fetch(url):
    parts = urlsplit(url)
    conn_cls = http.client.HTTPSConnection if parts.scheme == "https" else http.client.HTTPConnection
    conn = conn_cls(parts.netloc, timeout=15)
    path = parts.path or "/"
    if parts.query:
        path += "?" + parts.query
    conn.request("GET", path, headers={"User-Agent": "redirect-trace/1.0"})
    resp = conn.getresponse()
    status, location = resp.status, resp.getheader("Location")
    conn.close()
    return status, location

def trace(url):
    seen, hops = [url], []
    while True:
        status, location = fetch(url)
        if status in (301, 302, 303, 307, 308) and location:
            nxt = urljoin(url, location)
            hops.append((status, url, nxt))
            if nxt in seen:
                return hops, "LOOP"
            if len(hops) >= MAX_HOPS:
                return hops, "TOO MANY"
            seen.append(nxt)
            url = nxt
        else:
            return hops, status

args = sys.argv[1:]
urls = open(args[0]).read().split() if args and not args[0].startswith("http") else args
for start in urls:
    hops, end = trace(start)
    label = "OK" if len(hops) <= 1 and end == 200 else "FIX"
    print(f"{label}  {len(hops)} hop(s)  final={end}  {start}")
    for status, src, dst in hops:
        print(f"      {status}  {src} -> {dst}")

Run it with python3 trace_redirects.py urls.txt. A row marked FIX is either a chain of two or more hops, a loop, or a redirect that ends somewhere other than a 200. A single hop marked OK is fine for an old URL that outside sites link to, but your own pages should link straight to the final URL with no hop at all.

To build urls.txt from a sitemap, pull out the <loc> values. Every URL in a sitemap should answer 200 directly, so any redirect in that list is something to fix in the sitemap itself. The technical SEO audit walkthrough shows a crawler that records hop counts for every internal link, if you need full site coverage rather than a list.

How do you fix a redirect chain?

The fix is always the same idea: make every source point at the final destination in one hop, then stop sending people into redirects at all.

  1. Write down the chain. For /2019/hello-world to /blog/hello-world to /blog/hello to /writing/hello, the only URL that matters is the last one, and it must return 200.
  2. Repoint every old rule at the end. Change each source in the chain to redirect straight to /writing/hello. Keep the old rules; deleting the middle ones breaks every link that still uses those URLs.
  3. Update your own links. Change internal links, navigation, canonical tags and sitemap entries to the final URL so your own pages cause zero hops.
  4. Fold host level hops together. If HTTP to HTTPS, bare domain to www, and trailing slash rules each fire separately, make the first rule send traffic straight to the final protocol, host and path.
  5. Re-run the trace. Every source URL should now show exactly one hop ending in 200.

On a site with dozens of migration rules, step 2 is tedious by hand. This script reads a Netlify _redirects file and rewrites each plain path rule so it points at its final target. It follows Netlify's first match rule, treats paths with and without a trailing slash as the same, marks duplicate rules that can never fire, and prints loops for you to fix by hand. Rules with splats, placeholders or conditions are passed through untouched.

#!/usr/bin/env python3
"""Flatten chains in a Netlify _redirects file so every rule points at its final target.

Handles plain path-to-path rules. Rules with splats (*), :placeholders, query
matching or conditions are passed through untouched and listed as skipped.
Usage: python3 flatten_redirects.py _redirects > _redirects.flat
"""
import sys

def key(path):
    return path.rstrip("/") or "/"   # Netlify matches with or without a trailing slash

rules, order = {}, []
skipped = []
for line in open(sys.argv[1]):
    raw = line.rstrip("\n")
    parts = raw.split()
    if not parts or parts[0].startswith("#"):
        order.append(("raw", raw))
        continue
    simple = (len(parts) in (2, 3) and "*" not in parts[0] and ":" not in parts[0]
              and "=" not in raw and not parts[-1].endswith("!"))
    if not simple:
        skipped.append(raw)
        order.append(("raw", raw))
        continue
    src, dst = parts[0], parts[1]
    status = parts[2] if len(parts) == 3 else "301"
    src = key(src)
    if src in rules:            # Netlify uses the first matching rule
        order.append(("raw", "# duplicate, never used: " + raw))
        continue
    rules[src] = (dst, status)
    order.append(("rule", src))

def final(src):
    seen, dst = [src], rules[src][0]
    while key(dst) in rules and rules[key(dst)][1].startswith("30"):
        if key(dst) in seen:
            return None, seen + [key(dst)]
        seen.append(key(dst))
        dst = rules[key(dst)][0]
    return dst, seen

for kind, val in order:
    if kind == "raw":
        print(val)
        continue
    dst, status = rules[val]
    if not status.startswith("30"):
        print(f"{val} {dst} {status}")
        continue
    end, path = final(val)
    if end is None:
        print(f"# LOOP, fix by hand: {' -> '.join(path)}")
        print(f"{val} {dst} {status}")
    elif end != dst:
        print(f"# was {dst}, a chain of {len(path)} hops")
        print(f"{val} {end} {status}")
    else:
        print(f"{val} {dst} {status}")

for s in skipped:
    print(f"skipped (not a plain rule): {s}", file=sys.stderr)

Run python3 flatten_redirects.py _redirects > _redirects.flat, read the diff, then replace the file. Tested in November 2026 on a sample file with a three hop chain, a two rule loop, a splat rule, a 302 and a trailing slash duplicate. The output keeps rule order, so the first match behavior does not change.

What causes redirect loops, and how do you fix them?

Loops almost always come from two systems that disagree about the correct URL. These are the patterns worth checking first:

To debug, trace the loop with the script above: the printed hops show which two URLs bounce, and the status codes usually tell you which layer sent each one. A 308 on Vercel or a 301 on Netlify from your own rules looks different from a redirect your CDN adds.

How do you avoid chains on Netlify and Vercel?

Most chains on static hosts come from mixing link styles with host settings, so set the rules once and write links to match.

Netlify. Redirect rules in _redirects default to 301 if you leave the status off, and the engine uses the first rule that matches, so put specific rules above general ones, per the redirect options docs. Netlify does not apply a normal rule when a file exists at the source path unless you force it with ! after the status code, which is a common reason a redirect appears to do nothing. With Pretty URLs on, link to /about/, not /about or /about.html, so visitors never take the forwarding hop. Netlify also notes that 307 is not supported in _redirects; use 302 for temporary moves.

Vercel. In vercel.json, a redirect with permanent: true, the default, returns 308, and permanent: false returns 307, according to Vercel's project configuration reference. Turning on cleanUrls removes .html extensions and answers any request for the extension with a 308 to the extensionless path, so /about.html goes to /about. If you enable it, update links that still end in .html. The trailingSlash setting adds or removes the slash with a redirect, so pick the value that matches how your links are already written, or every internal link costs a hop.

The same rule applies on both: one host level decision for protocol, host and slash, and every link, canonical tag and sitemap entry written in that final form. The guide to fixing 404 errors covers the redirect syntax for moved pages on both hosts in more detail.

How do you keep chains from coming back?

Chains grow every time a page moves twice. Three habits keep them short:

Add redirects to a broader recurring check alongside broken links, canonicals and status codes. The small site audit checklist puts these in priority order. If you work with Claude Code, CrawlKind runs that kind of crawl and reports every chain with its hops as evidence, and the sample audit shows what that report looks like before you change anything.

Sources

Frequently asked questions

How many redirects is too many?

For your own links and sitemap, any redirect is one too many: link straight to the final URL. For old URLs that outside sites link to, one hop is normal. Chrome's Lighthouse fails a page at two or more redirects, so treat any chain of two or more hops as something to flatten.

Should I delete old redirects after a migration?

Not while anything still links to the old URLs. Deleting a middle rule in a chain turns every link to that URL into a 404. Instead, repoint each old rule straight at the final destination, so every old URL takes one hop, and keep the rules in version control so you know why each exists.

Is a 301 or a 308 better for SEO?

Google treats both as permanent redirects and uses them as a signal that the target should be canonical. The difference is technical: a 308 keeps the request method, so a POST stays a POST. Use whichever your host issues by default; Netlify uses 301 and Vercel uses 308.

Why does my browser say too many redirects?

The URL is in a redirect loop: a later hop points back at an earlier URL, so the browser gives up. Common causes are two rules pointing at each other, a trailing slash rule fighting a host setting, or a CDN and server disagreeing about HTTPS. Trace the hops to see which two URLs bounce.

Do redirect chains waste crawl budget?

Each hop is another fetch, so long chains do cost crawling work. For most small sites with a few hundred pages this is not a real constraint. The practical costs are slower page loads for visitors and the risk that one broken hop turns the whole path into an error.

Audit your site with your AI coding agent

CrawlKind is a website audit and fix kit for Claude Code: a full crawl, a prioritized findings report, and proposed fixes you review before anything changes. $49 once.

See a sample audit

Checkout isn't open yet.

CrawlKind is being finished and tested before it goes on sale at $49, paid once. Nothing is charged today. Leave an email if you want one message when the kit ships. No newsletter, no follow-ups.

That email doesn't look right. Check for typos.One email when CrawlKind is available. Nothing else.

Saved. You'll get one email when the kit is ready.

Kevin Glover

@gloverbuilds

I ship small products in public. Building toward $1M with SideRoad.

● Built by @gloverbuilds