Question

Redirect Chains and Loops: Detection and Fixes

7 min read

Short answer

A redirect chain is a URL that redirects to another redirect before reaching a page; a loop is a set of redirects that never reaches one. Both are fixed the same way: every redirecting URL should point in one hop to the final URL, and every redirect rule should live in one place so two systems can't contradict each other. Google's crawlers follow "up to 10 redirect hops" by default, so a chain shorter than that still resolves for Google's main crawler, but each hop costs visitors a round trip and gives the setup another point where it can break.

Sources

  1. 1developers.google.com
  2. 2developers.google.com
  3. 3developer.chrome.com
  4. 4support.google.com
  5. 5developers.google.com

Ask next

What Chains and Loops Look Like

A chain:

http://example.com/old-page
  → 301 https://example.com/old-page
  → 301 https://www.example.com/old-page
  → 301 https://www.example.com/new-page/
  → 200

Three hops before the visitor or crawler gets content. The fix is one redirect from each of the first three URLs straight to https://www.example.com/new-page/.

A loop:

Rule A: https://www.example.com/*  → https://example.com/*
Rule B: https://example.com/*      → https://www.example.com/*

Each version sends the request to the other, so it never resolves. Browsers stop with a “too many redirects” error; Google reports a redirect error.

Why They Form

  • Layered migrations. An HTTP-to-HTTPS move adds a redirect in front of an older URL-change redirect, and a later redesign adds a third.
  • Several systems writing redirects. A server configuration, a CMS plugin, a CDN rule and an application router can each redirect the same URL without knowing about the others. That is also how loops form: one system sends A to B and another sends B to A.
  • Host and protocol rules applied in sequence. One rule forces HTTPS, another forces www, and a third adds a trailing slash, each as a separate hop.
  • Conditional redirects. Rules based on device, language or location that send some requests back to the URL they came from.
  • Internal links left pointing at old URLs. The redirects work, but every click and crawl goes through them.

What Chains and Loops Cost

Crawling. Google’s HTTP status code documentation says: “By default, Google’s crawlers follow up to 10 redirect hops. However, specific products’ crawlers may have different limits.” It also says that “Google Inspection Tools doesn’t follow redirects”, and that content from the redirecting URL “is ignored, and the final target URL’s content is processed instead.” A chain within the limit resolves, but each hop is a separate request.

Robots.txt has a lower limit. Google’s robots.txt specification says Google “follows at least five redirect hops” for the robots.txt file and then “stops and treats it as a 404 for the robots.txt file.” A chain on /robots.txt after a host or protocol change can leave Google without your rules.

Indexing errors. The Page indexing report lists “Redirect error” for “A redirect chain that was too long”, “A redirect loop”, a redirect URL that exceeds the maximum URL length, and “A bad or empty URL in the redirect chain”. A loop leaves Google with no page to index.

Speed. Chrome’s Lighthouse documentation on avoiding multiple page redirects says each extra trip “can delay the loading of the resource by hundreds of milliseconds.” The audit failed pages with “two or more redirects”; the page notes that as of Lighthouse 13 the audit moved into the “Document request latency” insight.

Whether a redirect loses ranking value is a different question, and not the reason to fix chains. Google’s documentation describes a permanent redirect as “a strong signal that the redirect target should be processed.” The reasons to flatten chains are the ones above: crawl requests, latency, the robots.txt limit and the chance of a broken hop.

Detecting Chains and Loops

A site crawler. Crawl the site with redirect following on, then export the redirect chains report. Look for any redirect that leads to another redirect, any loop, and any chain ending in a 4xx or 5xx. If the site has moved domains, let the crawler follow redirects to the other domain, because chains can cross from old to new.

The command line. For one URL, request it with GET, follow redirects and print each response’s headers:

curl -s -L -D - -o /dev/null https://example.com/test-url

Each HTTP/ status line and location: header in the output is one hop. To see only the final result and the number of hops:

curl -s -L -o /dev/null -w '%{http_code} %{num_redirects} %{url_effective}n' https://example.com/test-url

Use GET rather than a HEAD request (curl -I), because some servers answer HEAD differently from GET.

Browser developer tools. In the Network tab, with “Preserve log” on, load the URL and read each request’s status and location in order.

Search Console. The Page indexing report shows “Redirect error” for chains that are too long and for loops, and “Page with redirect” for non-canonical URLs that redirect. Google’s own help for redirect errors points to “a web debugging tool such as Lighthouse” for the details.

Server logs. Filter for Googlebot requests that receive 301, 302, 307 or 308 responses, then look for the same crawler requesting the next URL in the chain; see log file analysis.

Fixing Chains

  1. Map every chain. Export each chain with every intermediate URL.
  2. Decide the final URL. It should return 200, be the canonical you want and be the page that now carries the content. Canonical choices are covered in canonical tags.
  3. Point every URL in the chain straight at it. Before: A → B → C → D. After: A → D, B → D, C → D.
  4. Combine host and protocol rules. Handle http, https, www and the trailing slash in one rule that sends any variant directly to the preferred form.
  5. Update internal links, canonicals and sitemaps to the final URLs, so the redirects serve old external links and bookmarks, not your own pages. Internal link cleanup is covered in internal linking strategy, and sitemap rules in XML sitemaps.
  6. Retest each original URL and confirm one hop to a 200.

For large rule sets, generate the new rules from the exported map, but review them before deployment: a generated rule that matches more URLs than intended can create new chains or loops.

Fixing Loops

  1. Trace the loop. Run the curl command above and note which URL repeats.
  2. Find the system behind each hop. Response headers can show whether the CDN, the web server or the application issued a redirect.
  3. Remove or rewrite the conflicting rule. For www and protocol loops, keep one canonical host rule. For CMS and server conflicts, move all redirects for those URLs into one system.
  4. Check conditional rules. A redirect based on language, location or device must never send a request back to the URL that redirected it. Test with the conditions that trigger each branch.
  5. Retest across variants: http and https, www and non-www, with and without the trailing slash.

Preventing New Chains

  • One source of truth. Manage redirects in one system. If the server handles them, don’t add CMS redirects for the same URLs.
  • Update, don’t append. When a URL that already redirects moves again, change the existing redirect’s target instead of adding a new one after it. If old-page redirects to old-page-v2 and the content moves to new-page, make both redirect to new-page.
  • Check before adding. Before each new redirect, search existing rules for the source and the target.
  • Test before release. Run the redirect map against a staging environment before deploying.
  • Audit after every URL change, migration or protocol change, not on a fixed calendar alone.
  • Keep redirects in place. Google’s site move guide says to keep them “for as long as possible, generally at least 1 year”. Flattening a chain means changing targets, not deleting redirects.

During Migrations

Migrations add redirects on top of old ones, so they are where chains multiply:

  • Before: crawl the current site, fix existing chains and loops, and export every live redirect.
  • Mapping: map each old URL, including URLs that already redirect, directly to its final new URL. Google’s site move guide warns against redirecting “many old URLs to one irrelevant single URL destination, such as the home page of the new site”, which “might be treated as a soft 404 error.”
  • After launch: crawl again, check robots.txt for hops, and watch the Page indexing report for redirect errors and new 404s.

Status code choices are covered in HTTP status codes, and protocol moves in HTTPS migration.

After a host or protocol change, request /robots.txt on every variant first. Google follows “at least five redirect hops” for that file and then treats it as a 404, which leaves Google crawling without your rules, so each variant should reach the final robots.txt in one hop.

Link profile