HTTP Status Codes Explained
Introduction
If you’ve ever wondered what a HTTP Status code is, you’re in the right place. This resource is here to tell you about every type of HTTP status code, what they mean, why they’re important and how they can affect your website and digital marketing strategy.
What is a HTTP status code?
HTTP status codes are standard response codes that indicate the status of a request made to a server.
HTTP Status Codes are a crucial part of the internet and web browsing experience. They are messages sent by a server to a client, informing the client about the status of a request. These codes are usually three-digit numbers that indicate whether a request was successful or unsuccessful, and if unsuccessful, what went wrong.
There are a few things we should be aware of before we begin. Have you ever heard of a user agent, request method, or upstream server? If not, brace yourselves because things are about to get technical.
Clients and servers are the two fundamental components at the heart of the internet. Any time you open your laptop, a browser, or click on an online page, you are using a web client to access the internet. Every time you visit a website, whether using Chrome, Internet Explorer, or Safari, you send a request to a web server, each of which has a distinct IP address (Google's is 216.58.214.78, for example).
When you visit any page on the internet or interact with a website (by clicking a link, for example), you frequently ask that server for a large number of documents. The fundamental interaction remains the same whether it is HTML, CSS, an image, or a PDF file: you submit a request, and the server answers.
These queries are being sent using a language known as a HTTP protocol. Ultimately, these protocols are merely standards that have been adopted by the whole internet. There are many different protocols available, and you have probably previously encountered some of them:
- DNS – Domain Name System
- FTP – File Transfer Protocol
- HTTP – Hypertext Transfer Protocol
- IRC – Internet Relay Chat Protocol
- SMTP – Simple Mail Transfer Protocol
- SSL: Secure Sockets Layer
Core HTTP Code Blocks
As mentioned, the basis of the internet is a pretty straightforward interaction between clients (like Chrome) and servers, which exchange requests and responses. The purpose of status codes is to indicate if an HTTP request was successful, unsuccessful, or something in the middle.
Each status code has a unique meaning, but generally speaking, it's a good idea to be familiar with the following five:
- The 1xx block: informational requests
- The 2xx block: successful requests
- The 3xx block: redirects
- The 4xx block: client errors
- The 5xx block: server errors
Some of the most common status codes are 301 redirects, 304 not modified, 400 bad requests, 404 not found, 500 internal server error, 502 bad gateway and 504 gateway timeout. So let’s delve in to what each individual code means
1xx HTTP Status Codes
1xx HTTP codes are informative queries, as we learned previously. This is a transitional phase indicating that the server has not yet finished processing the request.
Even while it's rare that you'll see these codes frequently, it's still crucial to understand what they mean, so here's a brief rundown:
- 100 – Continue
- 101 – Switching protocol
- 103 – Checkpoints
2xx HTTP Status Codes
In essence, these are the requests that were granted, demonstrating that everything went according to plan, which is the ultimate goal. Therefore, if you get an HTTP status code of 2xx, don't be alarmed; everything is paddling along as planned.
- 200 – OK (you will see this one the most)
- 201 – Created
- 202 – Accepted
- 204 – No Content
- 205 – Reset Content
- 206 – Partial Content
- 207 – Multi-Status
- 226 – IM Used
3xx HTTP Status Codes
These HTTP response error codes are displayed when you request an address and are directed elsewhere. Redirects come in a variety of forms; we'll discuss some of them in more detail later. But for the time being, here are the 3xx redirection request codes:
- 301 – Moved Permanently
- 302 – Found
- 303 – See Other
- 304 – Not Modified
- 305 – Use Proxy
- 307 – Temporary Redirect
4xx HTTP Status Codes
Each of these codes refers to a client error. That indicates that something is amiss with the requests or the syntax (the structure of statements in a computer language) because the page wasn't found.
In the 400 status codes, a 404 code is the most common and is usually when you reach a web page that has not been found.
There are quite a few things to keep in mind, so we'll go over a couple of them in more detail below, but whatever is going on, the problem is usually on the client's end:
- 400– Bad Request
- 401– Unauthorised
- 402– Payment Required (Reserved for Future Use)
- 403– Forbidden
- 404– Not Found
- 408– Request Timeout
- 410– Gone
- 411– Length Required ( Content-length HTTP Header is needed)
- 413– Payload Too Large (OR Request Entity Too Large)
- 414– Request-URI Too Long
- 415– Unsupported Media Type
- 416– Requested Range Not Satisfiable
- 418– I'm a teapot (yes, you read that right)
- 422– Unprocessable Entity;
- 424– Failed Dependency;
- 428– Precondition Required;
- 429– Too Many Requests;
- 451– Unavailable for Legal Reasons.
The 5xx HTTP Status Codes
These response status codes show up when the client submits a valid request, but the server fails to fulfil it. These errors are caused by the server, not by the client. For instance, if you successfully access a webpage on client Chrome but instead get a 5xx code, there is a server problem.
Some of the most important examples include:
- 500 – Internal Server Error
- 502 – Bad Gateway
- 503 – Service Unavailable
- 504– Gateway Timeout
- 505– HTTP Version Not Supported
- 507 – Insufficient Storage
Why Status Codes Matter for Digital Marketing
Now we’ve covered each status code, it's time to get into some technical details. It’s important to have some knowledge about these codes whether they’re good or bad so that your website and digital marketing strategy can stand strong in times of technical issues.
Some HTTP codes that are very important for your digital marketing efforts include the following:
Status Code 200
200 requests is great news. A HTTP status code of 200 indicates that your GET Request was successful, which is what you want. A properly working URL will return a status code of 200. Everything has been requested and returned without any issues.
Status Code 301
301 status codes are also good. They are sometimes referred to as "301 redirects" and appear when a requested resource has been permanently transferred. They must be utilised once you have permanently switched out one URL for another. The old URL will no longer appear in search results and will be permanently replaced with the new URL for users and bots. The previous URL will eventually be removed.
What is significant, and arguably most important, about these redirection is that the link equity has been transferred from the old URL to the new URL meaning that if you have a number of links on an old URL and 301 redirect that old URL to the new one, you'll gain all of that link equity—and the new URL has the potential to replace the old one in search results.
Status Code 302
In general, it's not a good idea to use the 302 redirect (Response Found).
Typically, you don't want to put them into practice, although they behave similarly to 301s, they fail when it comes to the link equity. The resource is situated elsewhere, as indicated by the Location header.
These are often only used in short-term circumstances because search results do not replace URLs, and subsequent queries should utilise the original URL. This is useful in a few circumstances, such as transitory situations where data collection is necessary. A 302 redirect, for instance, may be used if you are performing an A/B test manually and bucketing users on your own.
In most cases, you should stick to 301 redirects.
Status Code 304
The conditional HTTP status code 304 (Not Modified) is returned when a file on the server has not changed since it was last visited. Because requests from browsers and bots carry a "If-Modified-Since" header, they will not be fulfilled if the file has not been modified since.
Large sites typically utilise this type of response to optimise the crawl path (above hundreds of thousands of pages). While the majority of smaller websites don't require this, if your site is large, it is a significant optimization. You can free up some of your crawl funds by delivering a 304 Not Modified header, freeing up Google's bots to search for new pages that it isn't currently aware of.
Accordingly, if you have more crawl funding, pages, and authority, this becomes increasingly beneficial. The more in-depth a website is and the more data you need Google to retrieve, the more useful 304 redirects become.
This loses value, though, if you have fewer than 1,000 or even 10,000 pages. As the number of pages increases into the hundreds of thousands and millions, this becomes increasingly important.
Status Code 401
Client problems are the focus of the status code 401 (Unauthorised).
This indicates that your login information is invalid. The server is only requesting that you check in again since it is unaware of your identity.
If you have a membership website or if you have to check in to a web application, this will often show up. Returning a 401 in these circumstances where the credentials were invalid is generally the best course of action.
Status Code 403
Although they differ slightly from 401 status codes, 403 status codes are comparable to them.
A 403 status code is substantially more clear than a 401 since it will translate to "Forbidden". In essence, a 403 code confirms your login details and notifies you that it is aware of your identity yet denies your access.
Think of a VIP area, the bouncer knows you but you have been put on the barred list so you’re not getting in - 403 is the strict bouncer of the club.
Status Code 404
This is a very common one. The 404 HTTP code sends a “Not Found” error message meaning that the URL being requested was simply not found.
It’s not true that all 404s are bad—this is a misconception. Google won't penalise you for serving a 404 if you just don't have that page or if a user types in an incorrect URL (you don't have to redirect every possible URL).
Having a nice 404 page is a terrific approach to tackle problems where a page is unavailable or the searcher mistyped it. A pleasant and straightforward notice such as "Sorry, the page you requested was not found. Here are some helpful links" is short, easy, and highly helpful to the user of the website.
On the other hand, you should swap out any authoritative pages that are 404s. Therefore, you want the API to do a 301 permanent redirect to the most pertinent page you have on your site if, for instance, a URL that once served a lots of links (or still serves them) is now displaying a 404 error. You shouldn't leave it like that.
Status Code 410
Similar to the 404 status code but a little more specific is the 410 status code (Gone). The page is no longer accessible on the origin server, and no redirect was put up, according to the "Gone" return code.
Web developers occasionally wish to inform Google and other search engines directly that a page has ceased to exist. This gives Google a lot clearer indication that a page has genuinely disappeared and won't be returning.
When Google encounters a 404, it could keep coming back and crawling for some time to verify that it was purposeful. A 410, on the other hand, quite clearly indicates that the page has vanished and that you should no longer look for it.
Status Code 429
The 429 status code, which means "Too Many Requests," is a client-side error, meaning that the client has submitted too many requests in a short period of time. Another name for this problem is "rate-limiting." Rate-limiting search engines should be avoided if your technical staff is actively attempting to thwart bots. Rate limitations occur rather frequently as well, Google rate limits a number of search engine ranking tools because they send out too many queries. Attacks known as DDoS (Distributed Denial of Service) fundamentally include rate-limiting issues.
You may create the first line of defence against DDoS attacks by banning a certain IP address or permitting a specific IP address to send a set number of requests over a set amount of time so don’t go too crazy with the 429 status code.
Status Code 500
This is an internal server issue, not a client problem. It's confusing in several aspects, and a second attempt could provide a different outcome. The server is aware that something is wrong but is unsure of what it is.
This isn't a good sign and you want to have this fixed as quickly as possible, so contact your website host and web developer ASAP.
Status Code 503
The 503 (Service Unavailable) status code also happens on the server-side. Similar to a 500 error, this one indicates that the server is down, although it's normally an anticipated error.
While a 500 status code expresses it knows something is wrong but can’t pinpoint what, a 503 status code says', ‘yep something is wrong but we knew it was wrong’.
When this happens, it's generally due to something simple, like missing a site payment or receiving more requests than your plan permits and has a very easy fix- speaking with your web host or developer to resolve the issue.
Status Code 504
A 504 status code indicates a gateway timeout, which is also a server error. When the server sends this code, it means that the other server that was requesting information did not respond to it quickly enough.
It frequently indicates that something failed upon which you or the server depended, or that you timed out, preventing the server from responding to the entire request.
As with the 500 and 503 status codes, you should get in touch with your web host or developer to address the problem.
Conclusion
You now know how to use HTTP codes! These are all crucial for your website and your efforts in digital marketing, so keeping them in mind and using the knowledge in the future will save you a lot of headache. As always if you have any queries get in touch, we’re always happy to hear from you.