```yaml
product: AlterLab
title: "Redirect Chain — Web Scraping Glossary | AlterLab"
comparison_context: "AlterLab is an alternative to Firecrawl, ScrapingBee, and Bright Data."
source_url: https://alterlab.io/glossary/redirect-chain
```

protocol

# Redirect Chain

A redirect chain is a sequence of HTTP redirects (301, 302, etc.) from an initial URL to a final destination, which scrapers must follow to reach the target content.

HTTP redirects occur when a server responds with a 3xx status code and a `Location` header pointing to the new URL. Redirect chains arise when multiple redirects occur in sequence: an HTTP URL redirects to HTTPS, which redirects to a `www` canonical, which redirects to a localised URL. Most HTTP clients follow redirects automatically up to a configurable limit (typically 10–30 hops).

For scrapers, redirect chains matter because the final URL after all redirects is the actual resource, and intermediate URLs may have different HTML than the destination. Tracking the full redirect chain is useful for link-shortener expansion, affiliate URL resolution, and detecting cloaking (where search-engine bots are served different content than users).

Excessive redirect chains (5+) indicate configuration problems on the target site and add latency. Circular redirects (A → B → A) must be detected and broken to prevent infinite loops.

### What is Redirect Chain?

A redirect chain is a sequence of HTTP redirects (301, 302, etc.) from an initial URL to a final destination, which scrapers must follow to reach the target content.

### How does AlterLab handle Redirect Chain?

Excessive redirect chains (5+) indicate configuration problems on the target site and add latency. Circular redirects (A → B → A) must be detected and broken to prevent infinite loops.

## Examples

```
# httpx: capture redirect history
import httpx

response = httpx.get("http://example.com", follow_redirects=True)
for r in response.history:
    print(r.status_code, r.url, "→")
print(response.status_code, response.url)
```

## Related Terms

[URLA URL (Uniform Resource Locator) is the address of a resource on the web, comprising a scheme, host, optional port, path, query string, and fragment.](https://alterlab.io/glossary/url)[HTTPHTTP (HyperText Transfer Protocol) is the application-layer protocol used by web browsers and scrapers to request and receive resources from web servers.](https://alterlab.io/glossary/http)[Canonical URLA canonical URL is the preferred URL for a piece of content when multiple URLs serve the same or similar content, indicated by a `<link rel='canonical'>` tag.](https://alterlab.io/glossary/canonical-url)[HTTP HeadersKey-value metadata fields sent with HTTP requests and responses that communicate authentication, content type, caching, and other directives.](https://alterlab.io/glossary/http-headers)[robots.txtA plain-text file at a website's root specifying which URL paths crawlers are permitted or disallowed from accessing.](https://alterlab.io/glossary/robots-txt)

## Extract Redirect Chain data from any website

AlterLab returns clean, structured data from any public URL — no scraper infrastructure needed. Start free, no credit card required.

[View API docs](https://alterlab.io/docs/api/rest)

[Back to Glossary](https://alterlab.io/glossary)