← Lessons

quiz vs the machine

Gold1400

Networking

HTTP Redirects and Status Families

How status codes group into families and how redirects steer the client.

5 min read · core · beat Gold to climb

Five families

HTTP status codes fall into ranges by their leading digit. The one hundreds are informational, two hundreds are success, three hundreds are redirection, four hundreds are client errors, and five hundreds are server errors. Reading the first digit tells you who is at fault and what to do next.

How redirects work

A three hundred response carries a Location header pointing at a new URL. The browser follows it automatically. The exact code matters:

  • 301 Moved Permanently says update bookmarks and pass link value to the new URL.
  • 302 Found and 307 Temporary Redirect are temporary; 307 preserves the original method while old clients sometimes switched 302 to GET.
  • 308 Permanent Redirect is the method preserving permanent form.
  • 304 Not Modified is special: it tells a cache its stored copy is still valid.

Avoiding loops

Chained redirects add round trips, and a misconfigured pair can form an infinite loop, which browsers cut off after a limit. Prefer a single hop to the final URL.

Key idea

Status codes group into five families by first digit, and 3xx redirects send the client to a Location while the specific code decides permanence and method handling.

Check yourself

Answer to earn rating on the learn ladder.

1. Which status family indicates a client side error?

2. What does a 301 redirect signal compared to a 302?

3. Which header tells the browser where a redirect points?