Error (404, 500, 301) or Not Exactly?
What do you usually do when you get an error message while visiting a website? Do you just click the X button on the tab or actually read the message? If you simply close the tab, this is probably not your website. But error messages are indeed very informative. Here’s why we decided to shed more light on the different types of messages we have faced while failing to load a website.
Error messages sometimes contain code in the displayed text such as error 500, not found 404, etc. These are also called HTTP status codes and are used by the web server to inform the client for successful or failed request processing and do not always signify an actual error.
There are a few types of status codes, as only the last two ones mean a real error. Listed according to their web specification they look like this:
- 1хх : Informational
- 2хх : Successful
- 3хх : Redirection
- 4хх : Client Error
- 5хх : Server Error
If the error message contains a status code starting with 4xx, this signifies that there is a problem with your request to the website, not that the website itself is currently down.
A full list of all HTTP status codes is available on the HTTP Status Codes – IANA: HTTP Status Codes.
Below you can read more about some of the most common status codes and what we should do if we face them:
HTTP 500 Internal Server Error
The message means that something is preventing the server from processing the client request and preparing a correct response or that there is no other specific information or another status code to describe the reason for this response refusal. The reasons for that might be:
- A certain setting on the server for keeping and maintaining its operation is conflicting with an incorrectly executed process.
- The whole application or a part of it is incompatible with the system environment or the available server technologies.
- Internal incompatibilities of the technologies used by the application itself, as well as the very common reason – incorrect program code.
If you get an error 500 message on your website you first need to check the server logs. Very often they contain information on the error and the most common reason is incorrect permissions.
HTTP 404 Not Found
404 Not Found or Not Found „The requested URL/resource was not found on this server“.
You surely have seen this message before. Not once. It is returned by the server when it fails to find the resource from the client request. For example if a file, directory or an image is deleted from the website, when the server tries to load the request URL, a 404 Not Found message will be returned. The most common reasons for 404 message are:
- incorrect URI;
- bookmark with invalid URL;
- non-existent link clicked from the search results;
- accessed link from the website content that’s not working anymore.
If you still want to get any information from the visited website, just delete the part of the URL entered in the browser until the website’s domain is left only. For example, if you entered http://mysupersite.com/dir/image.png and received a 404 Not Found message, you can delete the part following http://mysupersite.com.
HTTP 403 Forbidden
If you get a 403 Forbidden message, this means that access to the resource is restricted and the server denies returning the required content.
This message might be displayed if the website has a file/directory with incorrect permissions, forbidden access to .htaccess or a missing index file in the accessed directory.
Similarly as with the 404 code you can try changing the URL to get access to the website.
There is another list with the most popular status codes, but they are not usually seen by ordinary visitors on the web. These messages are displayed only to the web browser and the search engine bots (as well as any other application that can read HTTP responses of the server).
HTTP 200 OK
This is the most common code in this list. When a server has a response for a certain request it shows status 200 OK to the client. For example if there are 40 requests to the server for loading a certain page, at least for 38 of them the browser will get a status code 200. The rest of the codes might be 301, 302, 404, 403 or others.
Status code 200 is like the sound of an ATM machine counting and spitting out your money as it confirms the availability of the resource and the server sends content towards the client.
HTTP 301 Moved Permanently и 302 Found
These codes mean that the requested resource has changed its URL. They are used to show the web clients that the resource is redirected and they shall look for it on another URL. The 301 code signifies that the resource has been permanently redirected and the client should use only the new URL. The 302 code signifies that the new resource URL is temporary and the client should use the old URL in the future.
Search engines pay special attention to these two status codes, especially to 301. When this code is part of the site’s response it means that the URL should be changed in the search engine’s database.
All possible status codes you can encounter and those not seen at first sight are described in details in the HTTP protocol specification.
Next time you encounter any of the above mentioned status codes, do not hurry to close the tab, but instead keep calm and check whether this is really an error. 🙂