You’ve probably seen HTTP status codes before when a page you were trying to open wouldn’t load. Maybe you came across a 404 Not Found, or maybe a 503 Service Temporarily Unavailable. But did you know these status codes aren’t just about errors?
In fact, there are over 40 different HTTP status codes. Every time you’re clicking on a URL in your browser, a server will respond with one of these HTTP status response codes. And if you own (or manage) a website, knowing these codes can help you improve your online presence.
From delivering info from APIs (basically, any data delivery system like a Google scraper) to improving your site’s SEO performance, HTTP codes do it all. Below, you’ll find out exactly why HTTP status codes are important, and how they can help you and your business. Let’s find out!
What is HTTP?
The Hypertext Transfer Protocol (HTTP) allows for the communication between clients and servers on the World Wide Web.
The client is usually your web browser (e.g. Safari or Chrome). However, it can also be something else, like a robot crawling pages for a search engine index, for example.
Hypertext Transfer Protocol communication follows a few steps (the protocol):
- The client sends an HTTP request to the server
- The server receives the request
- The server processes the request
- The server returns an HTTP response
- The client receives the response
So, say you want to open a web page. Your browser sends the HTTP request to the server, asking to fetch the HTML document that constitutes that web page.
This request is parsed (broken down) to create all sorts of sub-requests. As such, one request asks for a specific image, another for a snippet of text, and so on.
On the other end is the web server, which receives the request and responds by serving the requested HTML document.
What are HTTP status codes?
In our example of the web page request, the server would have responded with an HTTP 200 OK status code, with the requested HTML document included in the response.
Of course, HTTP requests don’t always receive the same successful response. And that’s why there are many different HTTP status codes.
Status codes are divided into five different classes or categories. Each HTTP response status code is made up of three digits. One digit for the category, two digits for further identification of the unique status code. The five classes are:
- Informational (100-199)
- Success (200-299)
- Redirection (300-399)
- Client error (400-499)
- Server error (500-599)
As you can see, there are many possible HTTP status codes (and here’s the official registry of all possible codes). However, if you’re just browsing the web you’re likely to only encounter status response codes in the fourth and fifth category.
A well-known example is the 404 Not Found error, which means the server can’t find the requested resource. This can happen, for instance, when you’re trying to go to a URL that’s been deleted.
Another common example is a 504 Gateway Timeout, signifying the server couldn’t respond to the request in time. You might have seen this one when trying to get festival tickets the moment they’re released.
Too many clients (people who want to buy tickets) are trying to access the server (the festival’s website) at the same time, overwhelming the site with more traffic than it can handle.
As such, each status code gives the client information about the request they made to the server. And although it’s certainly helpful when you’re trying to open a page, there’s a lot more you can do with this knowledge.
Other usages of HTTP status codes
Imagine an API on your site is down without you realizing it. Before you know it, your customers start calling customer support complaining about their bad experience with your site.
Or maybe you wonder how it’s possible that with so much great content on your company’s site so little is actually ranking in the search results…
In both examples, there’s a good chance HTTP status codes can be the key to finding (and fixing) the problem.
HTTP status codes and APIs
Your site runs on both internal and external APIs that help provide your end-user with useful features and key functions. From processing payments to capturing leads, such functionalities work through APIs, and APIs work with HTTP status codes as well.
What this means is that you can monitor your APIs and the status codes they return to clients (users on your site) to stay on top of potential crashes. Knowing what the different HTTP status codes mean means you can either fix the API through coding yourself (when internal) or notify the external API about the issue.
HTTP status codes and SEO
Search engines have robots (called web crawlers or spiders) that crawl your site’s web pages so the search engine can index them. Such bots do this by following hyperlinks to different pages, requesting the server to view the page. The specific HTTP status codes returned by pages impact your website’s health in the eyes of the robot.
Say a bot is on your site, follows a URL you link to in an article, but the page has been deleted a while back. The bot receives a 404 Not Found error response. To a bot, such a response may signify the poor health of a site (although not always). So if your site contains a lot of 404 errors, your site’s rankings might drop in the search engine as a result.
Alternatively, when deleting the page you were smart enough to place a 301 Moved Permanently redirect and you redirected the URL to a new, live web page instead. You’ve made the bot happy, and it’ll continue its crawl.
And this is just one example. Knowing HTTP status codes and monitoring them on your site (using SEO tools like ScreamingFrog, for example) can help you optimize your website and improve your SEO performance.
Although most people only ever notice the error codes there is actually much more to HTTP status codes than just that.
Knowing how to identify different codes means you can use them to your advantage when improving your website.