HTTP Response Status Codes
When Web browsers and search engine bots request Web pages, the servers send back responses that contain status codes.
The first version of the HTTP protocol (0.9) didn’t have error messages. When a browser requested a Web page, there was no standard, machine-readable way for the browser to know if the request was successful or not — just a human-readable message:
Error responses are supplied in human readable text in HTML syntax. There is no way to distinguish an error response from a satisfactory response except for the content of the text.
To deal with that problem, later versions of HTTP added status codes to the responses.
An HTTP status code is a simple 3-digit number that tells Web browsers (and other clients like search engine bots) what happened when the page was requested. Some common status codes with their meanings are:
200— the request was okay404— the requested resource was not found301— permanent redirect302— temporary redirect500— internal server error
The codes have categories:
- 100-199 codes are informational.
- 200-299 codes mean that everything went okay.
- 300-399 codes mean a redirect of some kind.
- 400-499 codes mean there was a client error.
- 500-599 codes mean that there was a server error.
Example
The Request-Line in an HTTP request might look like this, saying GET me the /about page using version 2 of the HTTP protocol:
GET /about HTTP/2
and the server would send back a Status-Line like this:
HTTP/2 200 OK
which means, I’m replying with version 2 of HTTP and everything went okay with your request (200).
Takeaways
Things you should remember from this section:
- Servers send back an HTTP status code with their responses.
- The status codes are three-digit numbers that have different meanings based on their range.
- Browsers and search engines use the codes to determine what happened with the requests.
- If you want to memorize a few of the status codes to start, these are the most common ones:
200(everything is okay),301(permanent redirect),302(temporary redirect),404(page not found),500(internal server error).