Web Development

HTTP status codes explained: 200, 301, 404, 500

What HTTP status codes mean: the five classes, 200, 301, 401 vs 403, 404 and 500, why soft 404s mislead, and how to check a code in DevTools or with curl.

  • 8 min read
  • 5 questions
  • +35 XP
Transcript

HTTP status codes, explained by cats. Kitty runs a tuna shop website. Her server answers every page with a number. Three digits. That's the status code. The first digit says how it went. Starts with a 2? It worked. A 3?

Look somewhere else. A 4? The customer's mistake. A 5? Kitty's mistake. A cat opens the menu. 200. OK. The menu moves to a new page. 301. Moved for good. A cat opens her order history. Not logged in. 401.

'Who are you?' A logged-in cat tries the admin page. 403. 'I know you. Still no.' A cat types /salmon. 404. No such page. Then Kitty's code crashes. 500. Something broke inside. But servers can lie. Some send 200. With an error page inside.

Kitty's rule: the number matches the page. No tuna found? 404. Not 200. She checks with curl -I. Those are the most common status codes. There are dozens more. 451. Blocked for legal reasons. And 418. 'I'm a teapot.' Three little digits. So every cat knows if the tuna is coming.