Glossary

Redirect chain

What is a redirect chain?

A redirect chain is a redirect that leads to another redirect, and possibly more, before a page finally answers. A single redirect is one hop between the URL that was asked for and the page; a chain is two or more.

How it works

A server redirects by answering with a 3xx HTTP status code and a Location header that holds the new URL. The browser requests that URL at once, and it can answer with a redirect of its 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

Chains tend to grow by accident. Each rule makes sense on its own (plain HTTP to HTTPS, the bare domain to www, a trailing slash, a page that moved), and nobody sees them stack up.

The kind of redirect matters too. MDN groups 301 and 308 as permanent, after which search engines update the original URL, and 302, 303 and 307 as temporary, whose new URL they do not memorize. A loop is a chain that never reaches a page: a URL redirects, directly or through others, back to one already followed. When the server does not catch it, the browser does, and shows an error instead of the page.

Why it matters

Every hop is a full request before the real page is even asked for. MDN calls the cost of a redirect significant, advises keeping redirects to a minimum, and for links inside your own site recommends fixing the links rather than redirecting them. That time is also part of the time to first byte.

Crawlers stop somewhere: Google's documentation says its crawlers follow up to 10 redirect hops by default, and specific products' crawlers may have different limits.

What can go wrong

  • A migration redirects old URLs to pages that were later moved again, so old links now take two or three hops.
  • Links in your own navigation and content still point at old URLs, so every click on them goes through a redirect your site could skip.
  • Two rules disagree, one adding a trailing slash and another removing it, and the URL loops until the browser gives up.
  • A temporary redirect is used for a move meant to last, so search engines keep the old URL.

Check it

The HTTP status & speed check does not follow redirects, so it shows only the first hop's status code. curl -sIL followed by the URL prints every hop with its status and Location header. Ranetrace's broken link monitoring lists the internal links on a site that redirect, with the status of the first hop and the URL each one lands on.

Start monitoring today

Websites go down and code throws errors. Ranetrace tells you when it happens to yours, why it matters and what to do next.

Start your 30-day free trial From $9 a month. No credit card required.