Beginner’s guide to server response codes
Each time you visit a web page, a bureaucratic exchange takes place between your computer’s web browser and a distant web server.
Your web browser (called the “client”) begins the exchange by submitting a request to the web server for code, images, and other information.
The web server, always on the alert, returns a tiny message that says, “I received your request and here is what you can expect in the next few moments.”
This tiny message, including a server response code, is helpful to both the waiting client and human beings optimizing the experience.
Server response codes may appear to be errors at first glance; they’re most obvious when what the user wants to happen, doesn’t. On deeper inspection, these informational codes exist for every properly functioning online interaction. Server response codes, also called status codes, are feedback that your website is built correctly and web server functioning as intended.
Status Code Ranges
A status code’s leading number indicates its general meaning, making the codes predictable even if you don’t know the details. Every career SEO ought to know these by heart.
2xx – Successful
The general goal is to send the client to a web page with this response code range.
3xx – Redirection
These frequently misunderstood response codes help update the client’s outdated request.
4xx – Client Error
The request went wrong and the error is by the client. The most frequent response in this range is a broken link—the client requests information not existing on the server.
5xx – Server Error
The request went wrong and the error is by the server. Fixing this generally requires developer intervention.
Typical Status Codes
A large number of status codes are reserved by consensus, so web professionals can share an understanding of standard responses. The codes below appear regularly when you’re responsible for a website experience.
200 – OK
A 200 response from the server means, “Everything is great, and I’m sending the information you requested.”
This response code is generally ideal. Every first time a web page loads in your browser, this is the code received. To a search engine crawler, a 200 code says “I want you to keep this link as-is in your index.”
How could this response be an error? A few weeks ago I was looking to buy a shirt. A specific brand ranked well in search results and I immediately found pages of product links from their site that fit what I wanted. I clicked on the first product link and landed on the correct page, but there was no way to choose options or buy the shirt.
I went back to the search results and tried every link from that brand on the first page, with the same result.
With some research, I found that their web server showed a 200 response for every page that ever existed on their site. Because of this, old products were not removed from the search index and outranked buyable products in search results.
301 – Redirect Permanently
A permanent redirect acknowledges the client’s request and says, “That information now resides somewhere else.”
Instead of loading the old information, the server begins an updated request—a 301 response leads to a 200 response from the new location.
If the client is a search engine, the requested location is replaced by the new location in a search index.
A 301 response is ideal for correcting visitors who come to the wrong version of your domain, like non-www redirecting to www. This code is also great when you update and move content within your site. The idea is to make sure visitors to the old content are redirected to the updated content instead.
This response code is an error when the old location is still relevant, should be indexed, and needs to retain indexing signals. It’s also an error when the new location isn’t relevant to the old location; misuse of redirects is a common spam indicator.
302 – Found/Temporary Redirect
Temporary redirects acknowledge the client’s request and say, “I found the information you want, but it’s somewhere different at the moment.”
The server begins a new request, resulting in a 200 response from the new location. If the client is a search engine, the originally requested location is retained in a search index.
Google’s John Mueller has pointed out their algorithm does not penalize for 302 redirects, and the index will eventually treat a 302 as a 301 if it remains long enough. Likewise, a 301 response may be treated as a 302 by Google if there are enough signals to them that the old location is preferred.
This response code causes problems when a link should lead to a permanent new location (301) or a not found (404) response instead. Some developers erroneously chain 302 and 301 redirects together, increasing a page’s load time with every redirect.
304 – Not Modified
The 304 status code redirects to a file previously cached by the client.
The server says, “I have your request, but the information you want hasn’t changed since the last time you asked for it. Let’s not waste time; get the file you downloaded last time.”
This response code involves a lot of logic between the client and server in order to communicate how long cached information will be accurate. It can also indicate when cached information should be updated with a fresh download.
This status code doesn’t get nearly the attention its 3xx siblings do, but when you hear, “Please clear your cache to see the changes,” or have a talk about cache expiration headings, 304 is your code. Balancing caching with fresh content is an art complicated enough to warrant its own article.
403 – Forbidden
A 403 response is the server saying, “I understand your request but I won’t give you the information.”
This response is given when the client doesn’t have the access level the server requires. It’s a correct response when an unauthorized client is attempting to access sensitive areas of a website. This status is usually sent to search engines who try to crawl administration pages of a website.
This status code is an error when you intend the client to access the information. This happens commonly with over-engineered robots.txt files, but can be the result of a misconfigured web server.
404 – Not Found
The server says, “I can’t find that information, and it probably never existed.”
The most widely-recognized status code, a 404 serves the important function of informing the client that what it seeks does not exist.
Some people are so convinced the 404 is a complete error that they’ll go to great lengths to prevent a server from using it at all. They may redirect clients instead, leading to loops of links where the searcher never finds what they want as they follow a path that doesn’t end.
The 404 tells search engine crawlers that they’ve found a dead end and should look to another location—important when a crawler has limited resources to spend on a website.
The 404 response is not usually an error with the server, but the result of outdated or mistyped links leading to that location. If you see multiple 404 results from internal site links, fix the offending links immediately. If you see multiple 404 results from external links that can’t be updated, consider a 410 response instead.
410 – Gone
This status code is the server’s way of saying, “That information used to exist, but doesn’t anymore.”
It tells search engine crawlers and other websites that the requested information was available only for a limited time, and they should remove their links to it.
Search engine crawlers will continue to test a 404 page in case it’s appearing in error, but a 410 response is regarded as absolute. Because of the 410 status code’s specific meaning, developers often choose to prevent mistakes by returning a 404 for all “not found” and “gone” instances.
503 – Service Unavailable
The 5xx range codes take more digging to fix, and function as actual server errors. The 503 status code is more common—used when the server is overloaded and unable to respond to requests. The overload could be the result of misconfiguration, or a sudden and extreme increase in website traffic.
5xx range codes like the 503 are always priority fixes; you can’t optimize what clients can’t access.
Server response codes are an important aspect of understanding the information sharing process. Knowing each code’s appropriate use is a necessary skill, even if it’s not your role to configure the server itself. The idea is to communicate exactly what you intend, and the correct configuration depends on your goals.
Aimee Jarboe advises mid-market retailers at Virid, an ecommerce platform and services company. You can connect with Aimee on LinkedIn.
from Search Engine Watch http://ift.tt/1TpHFYs