Understanding HTTP Status Codes

November 1, 2024 in Website Security

Effective website management requires a thorough understanding of HTTP status codes—three-digit numbers that indicate the outcome of a client's request to your server. These codes encompass a range of responses, from successful requests to various client and server errors. Knowing the different HTTP status codes will help with diagnosing website issues, optimizing site performance, and enhancing user experience

This HTTP status code resource delves into their classifications, meanings, and impact on web operations, providing best practices for both resolving and preventing related issues. Whether you're dealing with client-side errors like 404 Not Found or server-side errors like 500 Internal Server Error, this guide offers the technical insights necessary for effective troubleshooting.

Table of Contents

What are HTTP status codes?

HTTP status codes are response messages the server sends back to the user after they make a request. These codes tell the user the outcome of the request, letting them know whether it was successful or if an issue occurred.

HTTP status codes fall into five main categories:

  • 1xx – Informational: The server acknowledges and processes the request.

  • 2xx – Success: The request was successfully processed.

  • 3xx – Redirection: The requested resource has been moved or redirected.

  • 4xx – Client Error: An error occurred on the client's side.

  • 5xx – Server Error: The server encountered an error while processing the request.

Now, let's review the complete list of specific status codes within each of these categories.

Full list of HTTP status codes

In total, there are 23 different HTTP status codes that a user can receive when they make a request to the server. Here is the full list, broken down by category:

1xx – Informational responses

1xx HTTP status codes indicate that the server has received the user's request and is working on processing it. It's a category that includes these four codes:

  • 100 (Continue): This code indicates that the server has received the initial part of the request and tells the user they can proceed with the rest of it. It's useful when a large request body needs verification before sending.

  • 101 (Switching Protocols): This indicates that the server is changing the communication protocol based on a request from the client (like switching from HTTP/1.1 to WebSockets).

  • 102 (Processing): This tells the user that the server has accepted the request but is still working on processing it.

  • 103 (Early Hints): Accompanying this status code are preliminary response headers that are sent to the user before the full response is ready. Their main function is to speed up how fast the browser preloads resources.

2xx – Success responses

2xx status codes indicate that the server has received, understood, and processed the request successfully. They usually mean that the user can proceed as planned, and they include these five codes:

  • 200 (OK): This response indicates that the request was successful and that the server has successfully returned the requested resource. 200 (OK) is the most common HTTP status code, and receiving it means that everything is working as expected.

  • 201 (Created): This indicates that the request was successful and that it resulted in a new resource being created. For example, a user might receive this response when they create a new account on your website.

  • 202 (Accepted): This status code means that the request has been received but is being processed asynchronously. It's common for tasks such as batch processing.

  • 203 (Non-Authoritative Information): This indicates that the server is returning information that comes from a third-party source or a source different from the origin server.

  • 204 (No Content): This means that the server has successfully processed the request, but there is no content to return. For example, a user might receive this response when an update is successful but no page refresh is needed.

3xx – Redirection responses

3xx HTTP status codes indicate that the user will need to complete further actions before the request can be processed—and these further actions typically involve a different URL. Here are the four status codes that fall under this category:

  • 300 (Multiple Choices): This status code means that there are multiple options for the requested resource—like different file formats or different language options—and the user is required to select one.

  • 301 (Moved Permanently): This means that the requested resource has been permanently moved to a new URL. 301 redirects are commonly used for SEO purposes, ensuring that old links transfer their ranking power to the new location.

  • 302 (Found): 302 redirects are used to temporarily redirect users to a new URL. They are useful when a page has been moved temporarily but will eventually be returned to its original location.

  • 303 (See Other): This status code directs the user to access the requested resource at a different URL. 303 redirects are most commonly used following a form submission to prevent duplicate submissions when the page is reloaded.

4xx – Client errors

4xx status codes are returned when there is an issue with the user's request (such as a mistyped URL or missing authentication). Here are the five different types of client errors that can occur:

  • 400 (Bad Request): This status code indicates that the request made by the user is invalid and cannot be processed. 400 errors are most commonly caused by things like incorrect API requests or bad URL structures.

  • 401 (Unauthorized): This status code is displayed when a user requests a resource that requires authorization to access. The user must provide valid credentials before the server will return the requested resource.

  • 402 (Payment Required): This code was originally intended for digital payment systems to indicate that payment is required to access a specific resource. However, it is rarely used today.

  • 403 (Forbidden): This means that the server understands the user's request but refuses to process it. 403 errors most commonly occur when a user tries to access restricted content without the necessary permissions.

  • 404 (Not Found): This status code means that the server could not find the resource that the user requested. 404 errors can occur when the user types in a URL incorrectly or when the page has been deleted/moved without proper redirection.

5xx – Server errors

5xx status codes indicate that the server encountered an issue while processing a valid request. They result from problems with the server, not the client, and they include these five status codes:

  • 500 (Internal Server Error): This is a generic error message that's returned when the server encounters an unexpected issue. Coding errors, server misconfigurations, and resource limits are a few issues that can commonly cause 500 errors.

  • 501 (Not Implemented): This status code means that the server does not support the functionality required to complete the user's request. 501 errors often indicate that a method like PUT or DELETE isn't supported by the server.

  • 502 (Bad Gateway): When the server is acting as a gateway or proxy and receives an invalid response from an upstream server, this is the error message that's returned. 502 errors commonly occur when an upstream server is down or overloaded.

  • 503 (Service Unavailable): 503 errors indicate that the server is temporarily unable to handle the request due to overload or maintenance. In most cases, the issue will be resolved automatically once the server recovers.

  • 504 (Gateway Timeout): This is another error that occurs when the server is acting as a gateway or proxy, and it means that it took too long for the gateway/proxy server to receive a response from an upstream server. Issues with the server chain or network delays are often the cause of 504 errors.

How they impact your website

HTTP status codes play a key role in helping website owners understand and resolve the issues that are impacting their sites. In some cases, they indicate that everything is functioning as it should and no action is required. In other cases, they point to underlying issues that must be resolved to prevent negative impacts on SEO and user experience.

Here are a few ways that different HTTP status codes will impact your website:

200 OK: The Foundation of a Functional Website

200 OK is the status code you want your users to receive in most situations, as it indicates that the server has successfully processed their request and delivered the desired content. Consistent 200 OK responses across your site ensure that all of your important pages are accessible—which is key for providing a positive experience to users and maintaining a positive perception with search engines.

301 Moved Permanently: Redirecting old URLs to new

The 301 status code is utilized to permanently redirect traffic from an old URL to a new one. This type of redirection is particularly important for SEO, as it transfers link equity from the original URL to the new destination, helping to preserve search engine rankings during site migrations or content restructuring. Implementing 301 redirects is essential to prevent the loss of search visibility when URLs change, and it also improves user experience by ensuring that visitors do not encounter outdated or nonexistent pages.

404 Not Found: Errors to clean up where possible

The 404 Not Found status code indicates that the server cannot locate the requested resource, usually because the page has been removed or the URL is incorrect. An excessive number of 404 errors can adversely affect your website's SEO performance. Search engines may interpret frequent 404 errors as a sign of poor site maintenance or outdated content. Additionally, these errors degrade the user experience by frustrating visitors who encounter dead ends.

5XX server errors: A barrier to search engine crawling

5XX server errors—like 500 Internal Server Error or 503 Service Unavailable—indicate problems on the server side, and these problems will often prevent both users and search engine bots from accessing the page. These errors can often slow down (or completely stop) search engines from crawling your site, which can result in negative impact on your SEO. In fact, frequent or prolonged 5XX errors can sometimes cause sites to be deindexed by search engines. Server errors should be resolved as quickly as possible, not only to boost SEO but also to maintain a good user experience.

How to check them

There are several ways to check HTTP status codes, including using browser developer tools, Google Search Console, and crawling tools:

Browser developer tools

Today, most browsers come equipped with built-in developer tools you can use to inspect HTTP status codes for individual web pages. Here's how to use Chrome's "Inspect" tool:

  1. Open the website page you want to check in Chrome.

  2. Right-click on the page and select "Inspect" to open Developer Tools. You can also open developer tools by pressing F12.

  3. Click on the "Network" tab.

  4. Refresh the page (F5 or Ctrl+R) to reload the network requests.

  5. The Network tab will display all requests made by the page, including their status codes. Look under the "Status" column to find the HTTP status codes for each request.

Google Search Console

Google Search Console is a free tool that provides insights into how Google's crawlers interact with your website. Here's how you can use it to identify pages with errors:

  • Log in to your Google Search Console account.

  • Select the website you want to check from the dashboard.

  • Go to "Index" > "Pages" to see an overview of indexed and error pages.

  • Google Search Console will highlight issues like 404 Not Found, 500 Internal Server Error, and other status codes that affect your site's indexing.

  • Click on the listed errors to see details and affected URLs.

Crawling tools

Screaming Frog is a popular SEO spider tool designed to crawl your websites and report data on all pages crawled, including HTTP status codes. Here's how to use it:

  • Open the tool and enter your website URL in the search bar.

  • Click "Start" to begin the crawl.

  • Once the crawl is complete, go to the "Response Codes" tab to see the status codes for URLs that were crawled.

  • You can filter the results by "Client Error (4xx)", "Server Error (5xx)", or "Redirection (3xx)" if you want to focus on specific types of issues.

Common errors & how to fix them

HTTP status codes don't always indicate errors, but when they do, it's important to promptly fix them. Here are troubleshooting guides for the three most common types of error codes:

500 Internal Server errors troubleshooting guide:

  1. Check server logs to identify specific issues, and look for recent entries that might pinpoint what triggered the error.

  2. For websites running on WordPress or a similar CMS, try increasing your PHP memory limit through your hosting control panel or php.ini file.

  3. Check for a corrupted .htaccess file by temporarily renaming the file and refreshing the page to see if the error is resolved.

  4. Disable plugins and themes to see if the error is caused by an issue with one of these.

  5. If none of these steps fix the error, contact your hosting provider for further assistance.

503 Service Unavailable errors troubleshooting guide:

  1. Check the server status to see if it's undergoing maintenance or experiencing heavy traffic, as this is often the cause of 503 errors.

  2. If you are able to access the server, you can try restarting it to clear temporary overloads or stuck processes.

  3. Malfunctioning plugins and modules can sometimes cause 503 errors. Try disabling them to see if it fixes the issue.

  4. A sudden spike in traffic could be due to a DDoS attack. Use a website security tool to check for unusual traffic patterns.

  5. If your website frequently encounters 503 errors during periods of high traffic, you may want to consider upgrading your hosting plan so that you have more server resources available.

404 Not Found errors troubleshooting guide:

  1. Make sure the URL is correct and doesn't include any typos or errors.

  2. If a page has been moved or deleted, set up a 301 redirect to guide users to a relevant page.

  3. Check for broken links using tools like Google Search Console or Screaming Frog.

  4. If the page was deleted accidentally, try restoring it from a backup or recreating the content.

  5. Create a custom 404 page to help users navigate back to your main content when they come across a broken link.

Enhance your website performance and security with the right tools

Effectively understanding and managing HTTP status codes is essential for maintaining your website's health and security. This task becomes much easier when you have the appropriate tools at your disposal.

With SiteLock's comprehensive website security solutions, you can automatically monitor your website around the clock and resolve things like errors and security issues proactively to prevent them from harming your site performance and overall user experience.

Get started with SiteLock's comprehensive website security solutions to help manage your website.

Latest Articles
Categories
Archive
Follow SiteLock