HTTP Status Codes

A HTTP status code, more commonly referred to simply as status code, is a three-digit status code which is send from the webserver to the client (a web browser or Google-Bot for example) as a page is requested. It is used to inform the client (user, Google etc) whether the HTTP-request has been processed successfully, or whether an error has occurred during the request for a URL.

This page, and its sub-pages, linked on the right or directly below this article will give you details one the whole range of topics surrounding HTTP status codes.

HTTP Status Codes: An Overview

Whenever you load a page, particularly if there’s an error, a HTTP status code will be displayed. The nature of the code depends on the type of response and where it originates from. It can be helpful for both the user and the developer. 

Understanding error codes is useful for anyone who owns a website, as it will help improve your user experience and lower your bounce rate, especially if you fix any error status codes. It can also inform users of the reason behind an error, and direct them elsewhere instead. 

The best known HTTP status codes

The best known HTTP status codes are:

  • 200 – OK

Meaning: The requested resource (URL) has been found on the server and can be transmitted to the client.

  • 301 – Moved Permanently

Meaning: The URL requested by the client has changed. The webserver automatically redirects the client to the new URL.

  • 404 – Not Found

Meaning: The resource (URL) requested by the client could not be found on the webserver.

  • 503 – Service Unavailable

Meaning: The webserver is temporarily not available. This could be due to maintenance or overload, for example.

Here is an overview of the different types of HTTP status codes to tell you more. 

1xx Informational Response

  • 100 continue
  • 101 switching protocols
  • 102 processing
  • 103 early hints 

The 1xx category is a response that indicates the request was received and understood. This category is somewhat of an anomaly in that this section of status codes is rarely used. 

2xx Success

  • 200 OK
  • 201 created
  • 202 accepted
  • 203 non-authoritative information
  • 204 no content
  • 205 reset content
  • 206 partial content
  • 207 multi-status
  • 208 already reported
  • 226 IM used

Any code within the 2xx category means the request was successful. Both 200 and 201 are similar, but 201 gives the browser a little more information as it means that something was created, whereas 200 literally means ‘OK’. 

204 is a common code within this category and means the server processed the request but it did not return any content. However, this is deliberate as not returning any content was the intention, and so is still considered a successful return. 

3xx Redirection

  • 300 multiple choices
  • 301 moved permanently 
  • 302 found
  • 303 see other
  • 304 not modified
  • 305 use proxy
  • 306 switch proxy
  • 307 temporary redirect
  • 308 permanent redirect

Websites are complex and the needs of your users or indeed your business model as a whole are ever-changing. Sometimes, a page may have moved or merged with another page, and so the original URL will no longer take the user to where they want to be. Or, perhaps your domain name has changed, and you don’t want to lose customers who still visit the old URL, so you instruct the page to redirect users over to your new website instead. Such examples are where the 3xx category of status codes would be used.

304 is a common status code in this category. It’s not so much about redirecting the user from one URL to another, rather it deals with caching information. If nothing has changed on the page, 304 will inform the user, without having to increase the amount of data which would slow down the browser. If any of the information had changed, then the status code would switch to the corresponding 2xx response. 

4xx Client Errors

  • 400 bad request
  • 401 unauthorized
  • 402 payment required
  • 403 forbidden
  • 404 not found
  • 405 method not allowed
  • 406 not acceptable
  • 407 proxy authentication required
  • 408 request timeout
  • 409 conflict
  • 410 gone
  • 411 length required
  • 412 precondition failed
  • 413 payload too large
  • 414 URI too long
  • 415 unsupported media type
  • 416 range not satisfiable
  • 417 expectation failed
  • 418 I’m a teapot
  • 421 misdirected request
  • 422 unprocessable entity
  • 423 locked 
  • 424 failed dependency 
  • 425 too early
  • 426 upgrade required
  • 428 precondition required
  • 429 too many requests
  • 431 request header fields too large
  • 451 unavailable for legal reasons 

The 4xx category is the most recognisable of all the HTTP status codes. Essentially, it is communicating that there is an error on the client’s side. From a webmaster’s perspective, 4xx codes are the ones to look out for, because they will generate a poor user experience if the user cannot complete the action properly. 

So for example, 401 unauthorized means you don’t have access to the page, which could happen if you don’t have permission to view its contents, or if you’re not logged in. 403 forbidden is similar in that you may be trying to view a page that requires admin permission to do so. 

Both 401 and 403 HTTP status codes act as a virtual gatekeeper protecting the website from suspicious activity. However, 401 is saying it doesn’t recognise the user at all, whereas 403 does recognise the user, but knows the user doesn’t have the right credentials to view the content. 

404 is arguably the most recognisable of all the HTTP status codes. It means that the page you are trying to access does not exist. As an example, if you manually typed in a URL and added a word to try and locate a page, but that page didn’t exist (at least under that particular URL) a 404 status code would be generated. 

A notable mention for the 4xx category is the 418 I’m a teapot code. It was generated as an April Fool’s joke, to mean ‘the server refuses to brew coffee because it is permanently a teapot’. While this status code is never actually used, Google created a page dedicated to it

5xx Server Errors

  • 500 internal server error
  • 501 not implemented
  • 502 bad gateway
  • 503 service unavailable
  • 504 gateway timeout
  • 505 HTTP version not supported
  • 506 variant also negotiates
  • 507 insufficient storage
  • 508 loop detected
  • 510 not extended
  • 511 network authentication required

5xx errors relate to errors within the server, namely that it’s unable to load because a connection cannot be established. Usually, the error is within the hosting platform itself and is unexpected. 

For example, 500 internal server error could be caused by a bug within the code, meaning the page doesn’t load as intended or at all. This kind of status code helps identify the location of the problem, namely that it is something within the server and not a user error. 

HTTP status codes and SEO

You should always evaluate the HTTP status codes during the course of a website’s OnPage optimisation and improve or repair them, if necessary. Through the evaluation of HTTP status codes you will be able to shed some light on whether the webserver works well and if all available content can be accessed by clients without a hitch.

Seeing how Google-Bot will periodically crawl a website, you should make sure that all linked content and URLs are accessible. Otherwise it might happen that non-accessible content gets removed from the Google index, and will therefore be unable to show up in the search results anymore.

Unofficial Codes

Other HTTP status codes run on a scale of 103 to 598. These codes are not specified by any standard, and therefore don’t fit into a particular category. 

A notable example is the 522 connection timed out error by Cloudflare. As Cloudflare acts as a middleman between the server and the user, if it has an error it’s not going to be able to pull up the result and so the site effectively goes down until it’s resolved. 

Conclusion

HTTP status codes essentially provide information on whether a page loaded correctly or not, and if not the reason why this was the case. It’s a method of webserver communication not only with users, but webmasters too. 

While all HTTP status codes have a valid purpose, the 4xx codes are the ones you and your users are more likely to encounter. Sometimes the error messages can be helpful, especially as the user may be required to login to continue. However, it’s worth remembering that any disruption to the user experience should be avoided where possible. This means, testing your site regularly especially for errors such as broken links. 

HTTP status codes can also be used to better communicate between different pages on your website. It’s highly recommended to regularly check the status of your website’s performance on tools such as Google Search Console, so you can identify any issues.

More information on HTTP Status Codes:

18.01.2021