Linkbruno

Redirect chains and loops

Updated 19 November 20269 min read

How a Linkbruno report shows it
4 hops
Link goes through a long redirect chain
harbor.example/docs
4 hops before the page
Check your site for this

Up to 25 pages and every link on them. No signup.

On this page
  1. Where chains come from
  2. What a chain costs
  3. Find a chain for one URL
  4. Find every chain on your site
  5. Flatten chains at the server
  6. Redirect loops
  7. Update the links that point into chains

A redirect chain is a URL that redirects to another URL that redirects again before you reach a page. A redirect loop is a chain that comes back to an address it already visited, so it never ends and the browser shows ERR_TOO_MANY_REDIRECTS in Chrome or "The page isn't redirecting properly" in Firefox. To fix redirect chains, make every old address go straight to its final URL in one hop, then change the links on your site to point at that final URL so they don't redirect at all. To see the hops for one URL right now, paste it into the redirect checker.

A typical chain, built from three rules that each made sense on their own:

http://example.com/blog           301  ->  https://example.com/blog
https://example.com/blog          301  ->  https://www.example.com/blog
https://www.example.com/blog      301  ->  https://www.example.com/blog/
https://www.example.com/blog/     200

And a typical loop, where one rule adds a trailing slash and another strips it:

https://example.com/shop          301  ->  https://example.com/shop/
https://example.com/shop/         301  ->  https://example.com/shop
https://example.com/shop          301  ->  https://example.com/shop/
...

Redirect loops below covers the common causes and how to break one.

Where chains come from

  • Canonical rules stacked one after another: http to https, then apex to www, then adding a trailing slash. Each fires separately, so one request can trip all three.
  • Old slugs redirected more than once. /blog/post was moved to /articles/post in one redesign and to /guides/post in the next, and the first rule still points at the middle address.
  • A migration on top of an older migration, where nobody updated the first redirect map.
  • Local redirects behind a proxy that terminates TLS. By default nginx turns return 301 /new; into a full URL built from the request scheme (nginx docs). Behind a load balancer that scheme is http, so visitors get Location: http://..., which then hits your https rule.
  • Platform defaults. Netlify's Pretty URLs forwards /about to /about/ (Netlify docs), and Vercel's trailingSlash and cleanUrls settings each answer the other form with a 308 (Vercel docs). A link to the other form, or a redirect that targets it, adds a hop.
  • Short links and tracking links: a shortener, then a campaign tool, then the page.

What a chain costs

Google's crawlers follow up to 10 redirect hops by default (Google, HTTP status codes). When a chain is too long, loops, or contains a bad URL, Search Console lists the URL under Redirect error in the Page indexing report (Search Console Help). Google's advice for site moves is stricter than the limit: "Avoid chaining redirects", and if you can't, "keep the number of redirects in the chain low, ideally no more than 3 and fewer than 5" (Google, site moves). Its crawl budget guide adds that long chains "have a negative effect on crawling", which mostly matters on very large sites (broken links and SEO).

Visitors pay for every hop too. Each one is another request, and Chrome's Lighthouse docs say that extra trip "can delay the loading of the resource by hundreds of milliseconds" (Chrome for Developers). The Fetch standard that browsers implement stops after 20 redirects with a network error (WHATWG Fetch), which is what a loop runs into.

Chains also break more easily. Every hop is another rule that can go wrong later, and if any one of them starts returning a 404, every link into the chain breaks with it.

Find a chain for one URL

With curl, -I asks for headers only and -L follows each redirect:

curl -sIL http://example.com/blog | grep -iE '^(HTTP|location)'
HTTP/1.1 301 Moved Permanently
Location: https://example.com/blog
HTTP/2 301
location: https://www.example.com/blog
HTTP/2 301
location: https://www.example.com/blog/
HTTP/2 200

Count the status lines: more than one 3xx before the 200 is a chain. On a loop, curl stops after 50 redirects with curl: (47) Maximum (50) redirects followed; add --max-redirs 10 to see the repeating pair sooner (curl manual).

Without a terminal, paste up to 10 URLs into the redirect checker. It shows each hop's status code and Location, the final address, loops, chains, http hops and redirects that end on a home page.

Find every chain on your site

A chain matters most when your own pages link into it, so what you need is the list of pages that carry those links. That takes a crawl that follows every link and records where each one sits; finding broken links covers how to run one. Linkbruno reports long redirect chains, redirect loops and redirects that end at an error, and for each one shows every page that carries the link and whether it sits in the navigation, footer or main text, so you can fix a template once instead of hunting post by post.

To check a list of old URLs instead, use Screaming Frog's list mode: upload the list, tick "Always Follow Redirects" in the Advanced tab of the spider configuration, then export the All Redirects report from the Reports menu, which shows the hop count and final URL for each (Screaming Frog tutorial). The free version crawls up to 500 URLs.

Flatten chains at the server

The rule everywhere: any variant of a URL (http, www, old slug) goes straight to the final scheme, host and path in one response. Put specific old-path rules above the general ones, and write their targets as full final URLs so they don't trigger the canonical rules afterwards.

nginx

A map keeps old paths in one list that every server block can use, so an old path on http://www. still lands in one hop:

# http context
map $uri $moved_to {
    /old-pricing          /pricing/;
    /blog/2019/05/hello   /blog/hello/;
}

server {
    listen 80;
    server_name example.com www.example.com;
    if ($moved_to) { return 301 https://example.com$moved_to; }
    return 301 https://example.com$request_uri;
}

server {
    listen 443 ssl;
    server_name www.example.com;
    # ssl_certificate and ssl_certificate_key for www.example.com
    if ($moved_to) { return 301 https://example.com$moved_to; }
    return 301 https://example.com$request_uri;
}

server {
    listen 443 ssl;
    server_name example.com;
    # certificates, root and the rest of the site
    if ($moved_to) { return 301 https://example.com$moved_to; }
}

The separate-server pattern for host redirects is the one nginx's own docs recommend (nginx docs). An empty map result counts as false in if, and map string matching ignores case (nginx map module). Behind a TLS-terminating proxy, set absolute_redirect off; or write full https:// targets as above.

Apache

In .htaccess or the virtual host, with mod_rewrite:

RewriteEngine On

# Old paths: straight to the final URL, whatever scheme or host they came in on
RewriteRule ^/?old-pricing/?$ https://example.com/pricing/ [R=301,L]
RewriteRule ^/?blog/\d{4}/\d{2}/(.+)$ https://example.com/blog/$1 [R=301,L]

# Everything else on http or www: one hop to https://example.com
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://example.com%{REQUEST_URI} [R=301,L,NE]

The ^/? prefix makes the patterns work in both .htaccess and server config, as in Apache's own examples (Apache docs). %{HTTPS} is "on" only when the connection to Apache uses TLS (mod_rewrite), so behind a load balancer that terminates TLS it's always off and the rule above loops. In that case test the proxy's header instead: RewriteCond %{HTTP:X-Forwarded-Proto} !https.

Cloudflare

Create one Single Redirect rule that catches both schemes on www (Rules > Overview > Create rule > Redirect Rule, as of October 2026):

  • When incoming requests match: Wildcard pattern, Request URL http*://www.example.com/*
  • Target URL: https://example.com/${2}
  • Status code: 301
  • Preserve query string: on

This follows Cloudflare's own example for moving a whole domain (Cloudflare docs). If multiple redirect rules match, the first one wins, and Single Redirects run before Bulk Redirects (Cloudflare docs). For long lists of old paths, use Bulk Redirects; the free plan allows 10 Single Redirect rules and 10,000 Bulk Redirect URLs as of October 2026 (Cloudflare docs). Cloudflare's docs don't say whether Always Use HTTPS runs before or after redirect rules, so after deploying, run the curl command above on http://www.example.com/some-page and count the hops.

Netlify

In the _redirects file:

# The first matching rule wins, so specific rules go first
/old-pricing                /pricing/            301
/blog/:year/:month/:slug    /blog/:slug/         301

# An old domain alias, both schemes, straight to the final host
http://old-example.com/*    https://www.example.com/:splat   301!
https://old-example.com/*   https://www.example.com/:splat   301!

Netlify processes "the first matching rule it finds, reading from top to bottom", and _redirects rules run before those in netlify.toml (Netlify docs). Domain-level rules need one line per scheme, as in Netlify's own example, and the ! forces the redirect even when a file exists at that path (redirect options). Write targets with the trailing slash if Pretty URLs is on, or Netlify adds a hop to append it. If an old path on the old domain should also arrive in one hop, add a full-URL rule for it above all of these. Netlify redirects between the apex domain and www for your primary domain on its own (Netlify docs).

Vercel

In vercel.json:

{
  "redirects": [
    { "source": "/old-pricing", "destination": "/pricing", "permanent": true },
    { "source": "/blog/:year/:month/:slug", "destination": "/blog/:slug", "permanent": true },
    {
      "source": "/:path*",
      "has": [{ "type": "host", "value": "old-example\\.com" }],
      "destination": "https://www.example.com/:path*",
      "permanent": true
    }
  ]
}

permanent: true sends a 308 (Vercel docs), which Google treats as permanent, like a 301 (Google, redirects). The host-matching rule follows Vercel's own example (Vercel docs). Set the www and apex redirect in the dashboard's Domains section instead of in vercel.json. If you use trailingSlash, write destinations in the form you chose. One user reported in September 2026 that http://www. requests take two hops on Vercel, because the https upgrade runs before the domain redirect and the order can't be changed per project (Vercel Community). You can't flatten that one, so make sure your own links use the final https:// host.

Redirect loops

A loop is two or more rules that send a request back and forth. The classic case is Cloudflare's Flexible SSL mode: Cloudflare talks to your origin over plain http, the origin redirects every http request to https, and the request bounces between them until the browser gives up. Cloudflare's fix is to remove the https redirect from the origin or switch the encryption mode to Full or higher; the reverse also loops, with Full mode and an origin that redirects https to http (Cloudflare docs). Other common loops:

  • An app behind a load balancer that checks whether the request was https, always sees http, and redirects again (the Apache %{HTTPS} case above).
  • One rule that adds a trailing slash and another that strips it. On Netlify a single rule can do it: paths are matched with or without the slash, and its docs show /blog/remove-my-slashes/ redirected to /blog/remove-my-slashes causing an infinite redirect.
  • A CDN redirect and an origin redirect for the same hosts that disagree on www versus apex.

To see which layer sends each hop, look at the headers from the curl -sIL output, and on Cloudflare use Cloudflare Trace to check whether a redirect rule fires for a URL.

Flattening the server rules fixes the cost for everyone who arrives from outside. Your own links should skip redirects entirely: Google's site-move guide says to "change the internal links on the new site from the old URLs to the new URLs", and Lighthouse's advice is to point links at the resources' current locations.

  1. Fix navigation, header and footer templates first; one edit covers every page.
  2. Then fix links in content, with a search-and-replace and a dry run first.
  3. Update canonical tags, hreflang links and sitemaps so they list final URLs.
  4. For outbound links that redirect, swap in the final URL if it's the same content. If the chain ends on the other site's home page, the page you linked is gone: treat it as a soft 404 and use the options in fixing broken links.

For chains created during a redesign or domain move, checking redirects after a website migration covers testing a whole redirect map before and after launch.

See what’s broken on your site

The free scan reads up to 25 pages and checks every link on them. No signup.

Related