Understanding HTTP Status Codes
At LearnHTML, we categorize these codes into five groups based on their first digit. This makes it much easier to diagnose what is happening between the client (your browser) and the server.
1xx: Informational
These codes mean the request was received and the process is continuing.
- 100 Continue: The server is ready for the rest of the request.
- 101 Switching Protocols: The server is changing protocols (e.g., to WebSockets).
2xx: Success
The best kind of codes! These mean the action was successfully received and accepted.
- 200 OK: The standard response for a successful request.
- 201 Created: A new resource (like a user account) was successfully made.
- 204 No Content: The request worked, but there is no data to send back.
3xx: Redirection
The requested resource has moved. The browser usually follows these automatically.
- 301 Moved Permanently: The page is gone forever; the browser should use the new URL.
- 304 Not Modified: The browser can use its "cached" (saved) version of the page.
- 308 Permanent Redirect: Similar to 301, but specifically for modern web standards.
4xx: Client Errors
These mean something went wrong on the user's side.
- 400 Bad Request: The server didn't understand the request (often a syntax error).
- 401 Unauthorized: You need to log in to see this page.
- 403 Forbidden: The server understands the request but refuses to give access.
- 404 Not Found: The most famous error. The page does not exist.
- 408 Request Timeout: The browser took too long to send the request.
5xx: Server Errors
These mean the server failed to fulfill a valid request.
- 500 Internal Server Error: A generic "oops" message when the server crashes.
- 502 Bad Gateway: One server got an invalid response from another server.
- 503 Service Unavailable: The server is overloaded or down for maintenance
- 504 Gateway Timeout: The server waited too long for a response from another server.
Why should you care as a Developer?
-
SEO: If your site has too many 404 errors, Google will rank you lower.
-
Debugging: If you see a 500 error, you know you need to check your server-side code (PHP, Python, etc.), not your HTML.
-
User Experience: You can create custom "Error Pages" for 404 errors to help users find their way back to your homepage.