HTTP status codes
An HTTP status code is a 3-digit number that the server uses to communicate the outcome of a request. The purpose of these codes is to provide fast, unambiguous feedback on the status of a request or resource.
The development of status codes began with the introduction of the HTTP protocol in the early 1990s. Since then, they have been continuously expanded to enable new web functions and more detailed answers.
Status codes are divided into five classes, which are indicated by the first digit of the code:
- 1xx: Informational answers
- 2xx: Successful answers
- 3xx: Diversions
- 4xx: Client error
- 5xx: Server error
Class | Meaning |
1xx | Informational |
2xx | Success |
3xx | Detour |
4xx | Client error |
5xx | Server error |
The first digit of a status code therefore indicates the category of the response. This helps developers and system administrators to quickly identify the area in which there is a problem.
HTTP status codes
So let’s take a closer look at these 5 types of status codes.
Informational answers (1xx)
Informational status codes that begin with 1 indicate that the request has been received by the server and the process is continuing. They are rarely seen in practice, as they are usually communicated internally between software components.
Examples of 1xx status codes
- 100 Continue: The server has received the initial parts of the request and the client should continue with the transmission.
- 101 Switching Protocols: The server agrees to switch protocols after being requested to do so by the client.
Successful answers (2xx)
This category indicates that the request has been successfully processed. The 2xx status codes are a clear sign that everything is going according to plan.
Examples and their importance in web traffic
- 200 OK: The request was successful. The answer depends on the request method.
- 201 Created: The request was successful and a new resource was created as a result.
Detour (3xx)
Redirection status codes that begin with a 3 inform the client that further action is required to complete the request. These codes are often used for permanent or temporary redirects.
Frequent 3xx status codes and their application
- 301 Moved Permanently: The requested resource has been moved permanently. Future requests should use the new URL.
- 302 Found: This indicates a temporary detour. The original request should be submitted again with a different URL.
Client error (4xx)
4xx errors indicate that there was a problem with the request that the client needs to resolve. These errors may indicate an incorrect URL, missing authentication or unauthorized requests.
Important 4xx status codes and what they mean
- 404 Not Found: The requested resource was not found. This is one of the best known status codes.
- 403 Forbidden: The server understands the request but refuses to authorize it.
Server error (5xx)
Server errors, indicated by 5xx status codes, indicate that the server has encountered a problem that is preventing it from fulfilling the request.
Examples of 5xx status codes and their effects
- 500 Internal Server Error: A general error indicating that the server has encountered an unexpected problem.
- 503 Service Unavailable: The server is currently unavailable, usually due to overload or maintenance work.
Meaning of the status codes
HTTP status codes play a central role in the HTTP protocol by providing quick and clear feedback on the status of a request or a resource. They enable efficient error handling and contribute to the optimization of web traffic.
How status codes influence communication between client and server
Status codes inform the client immediately about the success or failure of a request. This feedback is crucial for decision-making on the client side, e.g. whether an error needs to be rectified, a resource needs to be requested again or everything is working as expected.
Status codes and SEO
Search engines use HTTP status codes to understand the availability and status of websites. Certain codes, such as 404 (Not Found) or 500 (Internal Server Error), can have a negative impact on the ranking of a website if they occur frequently.
Important status codes for webmasters and SEO experts are:
- 200 OK: Indicates that a page has been loaded correctly. Essential for a good ranking.
- 301 Moved Permanently: Important for redirecting outdated URLs to current content without affecting the ranking.
- 404 Not Found: Should be minimized, as too many 404 errors can be seen as a sign of poor maintenance.
Examples of status codes
Common status codes and their interpretation:
- 200 OK: The request was successful. The most frequently seen answer on the web.
- 301 Moved Permanently: One of the most important answers for SEO, as it instructs search engines to transfer the link power to the new URL.
- 404 Not Found: Indicates that the requested resource cannot be found. Important to monitor and minimize.
- 500 Internal Server Error: A generic error code that indicates server problems. Should be fixed quickly so as not to affect user experience and SEO.
Best practices for the use of status codes:
- Correct use: Make sure that the correct status code is used for the respective situation.
- Monitoring: Regular checks for 404 and 500 errors to quickly identify and fix problems.
- Redirect strategies: Use 301 redirects to maintain SEO rankings with URL changes.
But what guidelines actually apply to developers and webmasters? We adhere to the following internally:
- Clarity: Provide clear, informative error pages for 404 and 500 codes.
- Logging: Log errors for later analysis and optimization.
- Responsiveness: Fix issues quickly to maximize user experience and SEO performance.
HTTP status codes are an indispensable tool on the web that helps to optimize communication between client and server and forms the basis for a successful SEO strategy. By understanding and applying these codes correctly, developers, webmasters and SEO experts can improve the performance of their websites and create a better user experience. This is why they are among the decisive factors in on-page optimization.