HTTP Status Codes 101
the foundations of web data exchange
The Hypertext Transfer Protocol is an application protocol for distributed, collaborative, hypermedia information systems that allows users to exchange data on the World Wide Web. It was developed by Tim Berners-Lee and is now coordinated by the W3C. HTTP, as a request-response protocol, allows users to interact with web resources like HTML files by sending hypertext messages between clients and servers. Then, HTTP clients typically communicate with servers using Transmission Control Protocol (TCP) connections.
HTTP status codes are used on the internet to signify whether a given HTTP request has been successfully completed. When a web page or other resource fails to load properly, the codes assist in determining the source of the problem. The term HTTP status code is actually the common term for the HTTP status line that includes both the HTTP status code and the HTTP reason phrase. HTTP status codes are sometimes called browser error codes or internet error codes.
According to the information message they represent and transmit, these response codes are classified into five categories. Namely,
- Informational responses (
100
–199
) - Successful responses (
200
–299
) - Redirection messages (
300
–399
) - Client error responses (
400
–499
) - Server error responses (
500
–599
)
As for introduction let’s see the most commonly used response codes.
1. Informational Responses(100–199)
Among the HTTP status codes accessible in the field of informational responses. The most common status codes are 100 and 101.
Continue(100)
This interim response indicates that the client should continue the request or ignore it if the request has already been completed.
Switching Protocol(101)
This code is supplied in response to a client upgrade request header and identifies the protocol to which the server is switching.
2. Successful Responses(200–299)
200 is the status code that is being commonly referred to in this category.
OK(200)
This is the ideal status code for a typical, daily, well-working page.
3. Redirection Messages(300–399)
You were redirected to another page. The request was received, but there is some sort of redirection. For example, the page you have been looking for has changed its source and may have been altered, in which case these signals will be examined. The common status codes in this category include 301, 302 and 304.
Moved Permanently(301)
A 301 redirect should be used if one URL has to be permanently redirected to another. In a 301 redirect, visitors and bots that land on that page will be passed to the new URL.
Found(302)
Unlike a 301 response a 302 response code means that the URI of requested resource has been changed temporarily.
Not Modified(304)
This is used for caching purposes. It tells the client that the response has not been modified, so the client can continue to use the same cached version of the response.
4. Client Error Responses
These status codes features an error on the website’s side of the conversation and often appears when a web page could not be reached or doesn’t exist. 400, 401 and 404 are the common one’s in this category.
Bad Request(400)
It appears that the server was unable to understand the request due to improper syntax detected on the client side.
Unauthorized(401)
Semantically this response means “unauthenticated”. That is, the client must authenticate itself to get the requested response.
Not Found(404)
This signifies that the server was unable to locate the file or page that the browser was requesting. 404s do not tell if the missing page or resource is gone forever or just for a short time. By entering a URL that does not exist, you can see what this looks like on your site. It’s like running into a brick wall. As you’ve probably noticed, when your visitors arrive at a page with a 404 error, they’ll either try again (if they’re lucky) or go to another site that provides the information they’re looking for.
5. Server Error Responses(500–599)
The last response category in the HTTP status codes is the server error responses. These response codes indicate a server-side failure. That means, the client made a valid request, but the server failed to complete it. In this class, the most prevalent response codes are 500, 502, and 503.
Internal Server Error(500)
A 500 is a common server error that will prevent visitors from accessing your website. Instead of a problem with missing or unfound pages, this status code indicates a server problem.
Bad Gateway(502)
This error response indicates that the server received an invalid response while acting as a gateway to obtain the response required to handle the request. Simply, it means that the server has received an invalid response from another server.
Service Unavailable(503)
A 503 response, which is a variant of the 500 series, indicates that the server is unavailable due to temporary overload or maintenance. This response code ensures that the search engines know to come back soon because the page or site is only going to be down for a short time.
Last words
Last but not least you can check the status code of any website you are browsing using the network section of the developer’s tool of your browser. And the major importance of HTTP status codes is for Search Engine Optimization (SEO.) It’s worth learning — and committing to memory as they provide direct information on the health of a website and help pinpoint possible problems with the requested content.