Http Status Code


A status code is a part of the response returned by the server when a client (e.g., a browser) calls a URL. With the help of a status code, the server tells the client whether the request was successfully processed or whether an error occurred.

httpStatusCode de en.png

Status classes

The three-digit HTTP status codes can be classified in different status classes, where the first digit stands for the respective status class.

  • HTTP status codes of the first class represent information for processing and are sent during the request, they include status code 100 and status code 102.
  • HTTP status codes of the second class represent a successful operation. One of the most common HTTP status codes that begins with a 2 is status code 200 OK.
  • A status code of the third class represents a redirection and is returned if the requested document is now available at a different address. Processing is, therefore, not yet complete and requires further actions by the client. Some of the most important status codes in this class with respect to search engine optimization are status code 301 and status code 302.
  • HTTP status codes of the fourth class represent client errors, i.e. errors that results from a faulty request by the client. A good example in this class is status code 404 Not Found.
  • The fifth class contains server errors. These are errors that are attributed to the server. status code 500 Internal Server Error and status code 503 Service Unavailable are good examples in this class.
  • The ninth status class covers both the standardized status codes as well as proprietary codes that may occur under certain circumstances. Here, the error is attributed to the network, and the client is required to resend the request. Most common in this class are status code 906 and status code 950.

Check HTTP status codes

Normally, the web browser does not show the status code. Therefore, you have to use special tools to monitor these. Browser extensions are a good way of monitoring HTTP status codes such as using Live Http-Headers or using special online tools like Web-Sniffer.

Status code 1xx - information

Status code 100

Status code 100 is returned if the server has correctly received a request and is now waiting for further instructions from the client. Only then can the request be executed by the server.

Status code 102

This processing status code is used to prevent a timeout during the request. This can happen especially if the server has to process a time-consuming request.

Status code 2xx – successful operation

Status code 200

Status code 200 is returned by the server if the data requested by the client (e.g., web browser) were transmitted as desired. Here, the following requirements usually have to be met:

  • The server must accept the client’s request, and
  • the requested resource must exist on the server.
  • In addition, the server must be in a position to send the resource to the client.

If these requirements are met, the requested data are sent to the client and the status code 200 OK is included in the response.

Status code 200 is one of the most commonly occurring status codes as it represents the normal case. The status code is returned when there are no problems.

Status code 3xx - redirection

Status code 301

Status code 301 shows that the resource requested by the client is no longer available at the given address but has rather been permanently moved to another address (redirect). The old address of the resource is henceforth no longer valid. The new address is sent back to the requesting client, enabling the client to retrieve the resource at the new address.

The difference between status code 301 and the very similar status code 302 lies in the time designation. While the old address remains valid if status code 302 is returned, the old address is no longer valid if status code 301 is returned. The 301 redirect thereby inherits the link juice, whereas this is not the case with 302.

Use case – URL change

In the best case scenario, a once assigned URL structure remains unchanged forever. However, if it becomes necessary to change the URL structure of a page or to change its domain, it must be ensured that all the old URLs are redirected to the new URL. This particularly applies to URLs that have acquired valuable external links over time. This is done using a 301 redirect. In this case, if the no longer existing URL is called, the server returns the status code 301 and informs the client of the new URL of the resource. According to the RFC standard, an absolute URL should be used in a redirect. Thus, relative redirects are not valid.

Using 301

There are different ways of sending status code 301. For example, when using PHP-based applications, a corresponding header can be generated. To do this, the following PHP code must be added in the old file:

<!--?phpHeader( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?-->

It is, however, much more practicable to send the status code 301 using the .htaccess file. This requires a Linux server with an activated Apache mod-rewrite|Mod-Rewrite Module. The following lines must be added in the .htaccess file:

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

When using the status code 301, it should be ensured that all pages are redirected 1:1 to the new subpages and not to the homepage in case of a domain change. Furthermore, the so-called routing loops or long routing chains should be avoided. Googlebot usually switches off after the fourth or fifth redirection.

Redirection of links

A 301 redirect redirects most of the link juice to the new destination but not the reputation of the page on Google Plus (social signals). Before moving the content, one should first check whether the redirection is really desirable.

Status code 302

Status code 302 Found shows a temporary redirect. This means that the requested resource can temporarily be found at another address. In addition to this status code, the server also returns the new address of the resource. One important difference to Status Code 301 is that the original address remains valid. This is also the reason why contents that are permanently accessible at a new address should be delivered with status code 301 and not status code 302. This is because Googlebot continues to search through and index the original location during the temporary redirection. It is also important to ensure that no link juice is inherited with status code 302 but rather with status code 301.

Status code 400|Status code 4xx – client error

Status code 404

Status code 404 Not Found is always returned when the requested resource (mostly a URL but can also be an image or other file) does not exist or no longer exists, and is, together with the Status Code 200 “OK” and the 304 “Not Modified”, one of the most common HTTP status codes.

Reasons for the 404 status code

A non-existent resource can arise if:

  • The resource was moved to a different location, but not all internal links were altered accordingly.
  • The resource was moved to a different location, there were also external references to the document and in addition to the internal links. These were, however, not informed of the move and are, therefore, still linked to the old address. These are usually known as “dead links”.
  • The client has requested for a resource that never existed such as by modifying or tampering with an existing, valid URL in the address bar of the browser. This often occurs with copied links.

Rectifying the 404 error

It should always be ensured that the number of 404 errors is kept as low as possible. This is because neither users nor Googlebot are happy when they encounter an error page. One can use Google Search Console under “Status -> Crawl error” to regularly view the pages found by Google with status code 404. All the information about the internal and external links of the URL can also be viewed here. This makes it possible to detect and modify the important linked 404 pages.

Soft 404 errors

Soft 404 errors are encountered in websites that no longer provide the requested content nor return the 404 or 410 status code. In such cases, the webmaster has not provided any 404 error page, so that status codes “200 Ok” or “302 Found” are issued when visiting the pages.

In practice, there is little point when users search for specific content but are shown a page that does not show any error code and instead displays content that does not match the query. Google itself recommends the use of the 404 status code when the content is no longer hosted on a page.[1] For better usability, the error page can be optimized to persuade the users to stay on the website.

Common SEO tools, Google Search Console, or the Bing Webmaster tools can be used to analyze soft 404 errors.

Status code 5xx – server error

Status code 500

Status code 500 shows internal server errors. The requested resource can, therefore, not be transmitted due to a server error. Since this is basically a “generic HTTP status code” for all possible unexpected server errors, it is not that descriptive. However, status code 500 is mostly returned in the case of incorrect entries in the .htaccess file.

Status code 503

Status code 503 shows a temporary unavailability of the server. This can be as a result of several reasons. For example, this status code can be shown during maintenance or overload of the server. A “retry after” header field can be added to inform the client of the corresponding time when the sent request can be processed. It should hereby be noted that with status code 503, the server does not process the request even after the respective capacities are available again.

Status code 9xx – proprietary status codes

Status code 906

This status code is provided if an error occurs during transmission of the request from the client to the remote server. The request must be sent again.

Status code 950

Status code 950 is returned if an error occurs in the interpretation of an administrative request of the client. Here as well, the request must be sent again in most cases.

Significance of status codes for search engine optimization

The http status codes play an important role in search engine optimization. A high frequency of 404 errors can indicate a badly maintained website. If users receive the status code 404 when they access URLs, this leads to a higher bounce rate, which in turn represents a negative user signal for Google and other search engines.

The indication "404-not found" is a natural part of the web, if a page is no longer available, for example due to a domain transfer. Soft 404 errors, on the other hand, have a greater effect on search engine optimization. You deliver a status code that does not match the content of the page. In the worst case, Soft 404 errors can lead to the exclusion of a URL from the Google index.

Also important for the SEO are 301 redirects because they help prevent duplicate content.

References

  1. 404-Errors support.google.com Accessed on 01/25/2014

Web Links