Apart from the 404 error, how many other HTML error pages do you know about? Have you ever thought about what happens in the background when you see any of these HTML error pages on your screen?
Those codes are meant to convey important information to the user. It can be useful to know them better, especially if you are a website owner. Using them properly reduces your bounce rate, improves your search engine ranking and gives you knowledge on the performance of your site.
Understanding Status Codes
Behind every error page you see on the web there is an HTTP status code sent by the web server. Status codes come in the format of 3 digit numbers. The first digit marks the class of the status code:
- 1XX status codes have informational purposes
- 2XX indicates success
- 3XX is for redirection
None of these three classes result in an HTML error page as in this cases the client knows what to do and goes on with the task without hesitation. What we usually see are the 4XX and 5XX kind:
- 4XX represent client-side errors
- 5XXs indicate problems on the server side
HTML error pages are displayed in these cases because the client has no idea about what how to move on. Let’s see what happens in the background when something goes south and what you can do about it.
Client-Side Errors (4XX)
1. 400 – Bad Request
Whenever the client sends a request the server is unable to understand, the 400 Bad Request error page shows up. It usually happens when the data sent by the browser doesn’t respect the rules of the HTTP protocol, so the web server is clueless about how to process a request containing a malformed syntax.
When you see a 400 error page the reason is most likely that there’s something unstable on the client side: a not sufficiently protected operating system, an instable internet connection, a defective browser or a caching problem. So it’s always a good idea to test a bit your own PC before you contact the owner of the website.
Open the same webpage in a different browser, clear the cache, and check if you are due with security updates. If you regularly meet the 400 error on different sites, your PC or Mac is awaiting a thorough security checkup.
2. 401 – Authorization Required
When there’s a password-protected web page behind the client’s request, the server responds with a 401 Authorization Required code. 401 doesn’t return a classical error message at once, but a popup that asks the user to provide a login-password combination.
If you have the credentials, everything is all right, and you can go on without any problem and get access to the protected site. Otherwise you are redirected to the Authorization Required error page.
If you are a website owner, you can add the same password-protection to your site or a part of it through your cPanel account.
Click on the “Password Protect Directories” submenu inside the “Security” menu box and choose the web folder you want to protect. It can be a good security layer to restrict access to your admin area like the wp-admin folder in a WordPress site.
3. 403 – Forbidden
You can encounter the 403 Forbidden error page when the server understands the client’s request clearly, but for some reasons refuses to fulfil it. This is neither a malformation nor an authorization problem. By returning the 403 status code the server basically rejects the client with a big loud “No” without any explanation
The most common reason is that the website owner doesn’t permit visitors to browse the file directory structure of the site. When this kind of protection is enabled you can’t access folders directly on the website. The other frequent reason is that the specific file the client requested doesn’t have the permission to be viewed from the web.
You can set 403 protection for security reasons on your own site. It can be useful to harden your site against being hacked by hiding the directory structure or files that contain vulnerable information.
Luckily many web hosts provide this service to their clients by default, but if you want to add an extra security layer, open your cPanel account, navigate to the Advanced menu box, and click on Index Manager.
Here you can customize how your visitors view a specific directory on your site. If you choose No Indexing the client will receive an 403 error page if it tries to access the given directory.
4. 404 – Not Found
404 is the most well-known HTTP status code out there, and you have surely read many great posts about how to customize 404 pages. The browser returns a 404 HTML page when the server doesn’t find anything on the requested location.
There are two main scenarios that can result in a 404 Not Found page. Either the visitor mistyped the URL, or the permalink structure of the site has been changed and the incoming links point to pages that were moved to different locations. 404 error pages sometimes can appear on top level URLs too. It usually happens when a site has recently moved to another web server and the DNS still points to the old location. This kind of problem usually disappears after a short time.
You can find SEO experts on the web who claim too many 404s have a negative effect on your site’s search engine ranking, but Google claims that “404 errors don’t impact your site’s ranking in Google, and you can safely ignore them” as 404s are seen as a normal part of the web by the search engine.
You may want to reduce the number of your 404s because they increase the bounce rate (people who leave immediately) of your site. The most common solution for this is using 301 redirects for permanently removed pages, and 302s for those that are temporarily unavailable.
5. 408 – Request Time-Out
When the request of the client takes too long, the server times out, closes the connection, and the browser displays a 408 Request Time-Out error message. The time-out happens because the server didn’t receive a complete request from the client within the timeframe it was prepared to wait. Persistent 408 errors can occur because of the heavy workload on either the server or on the client’s system.
In some cases both ends of the connection work properly but a temporary internet surge slows down the delivery of the message. Bigger websites tend to customize 408 error pages just like most of you do, in case of 404s. 408 errors can usually be fixed by reloading the page with the help of the F5 button.
6. 410 – Gone
The 410 Gone error page is very close to the well-known 404. Both mean that the server doesn’t find the requested file, but while 404 suggests that the target file may be available somewhere on the server, 410 indicates a permanent condition.
410 shows the client that the resource was made intentionally unavailable, and the website owner wants incoming links to be removed from the Web. 404 is used when the server is unsure if the unavailability of the file is permanent, but 410 always indicates a complete certainty.
If you are in charge of your own server, it’s important to understand how 404s and 410s are treated differently by Google crawlers. In this video Matt Cutts, Google’s head of search spam explains the gist of this distinction. It’s a good idea to distinguish between 404 and 410 to enhance your Google-friendliness.
Server Errors (5XX)
7. 500 – Internal Server Error
Internal Server Error is the most well-known server error, as it’s used whenever the server encounters an unexpected condition that prevents it from fulfilling the client’s request. The 500 error code is a generic one, it’s returned when no other server-side 5XX error codes make any sense.
Although in this case the problem is not on your end, you can do some things to resolve it such as reload the page (as the error may be temporary), clear your browser’s cache (as the issue may occur with the cached version of the site), and delete your browser’s cookies and restart the browser.
You can also contact the webmaster (like in case of any other server-side problems) – they may be grateful for your contribution but there’s also a chance that they are aware of the problem and already working on it.
If you encounter the 500 error page on your own site, it will be wise to contact your hosting provider. The reason is most likely a permission error, a corrupt .htaccess file or a too low memory limit. If you have a WordPress site, the 500 error can also caused by a third party plugin; you can test this by deactivating your plugins, one by one, until the culprit is found.
8. 502 – Bad Gateway
The 502 error message represents a communication problem between two servers. It occurs when the client connects to a server acting as a gateway or a proxy that needs to access an upstream server that provides additional service to it. The other server is located higher in the server hierarchy. It can be for example an Apache web server that’s accessed by a proxy server, or the name server of a large internet service provider that’s accessed by a local name server.
When you encounter the Bad Gateway error page the server receives an invalid response from an upstream server.
In most cases it doesn’t mean that the upstream server is down but that the two communicating servers don’t agree on the protocol about how to exchange data. This usually happens when one of the machines is incorrectly configured or programmed. Contact your hosting provider if you see 502 on your own site.
9. 503 – Service Temporarily Unavailable
You see the Service Temporarily Unavailable (sometimes Out of Resources) message any time there’s a temporary overload on the server, or when it’s going through a scheduled maintenance. The 503 error code means that the web server is currently not available. This is usually a temporary condition that will be resolved after some delay.
If you are a website owner it’s important to have appropriate knowledge about the 503 status code to properly handle scheduled maintenance. If you don’t handle scheduled maintenance in the correct way, you may hurt the search engine ranking of your site.
10. 504 – Gateway Time-Out
There is a server-server communication problem behind the Gateway Time-Out error message, just like behind the 502 Bad Gateway error code. When the 504 status code is returned there’s also a higher-level server in the background that is supposed to send data to the server that is connected to our client. In this case the lower-level server doesn’t receive a timely response from the upstream server it accessed.
This is the same time-out problem that occurs in case of the 408 Request Time-Out status code, but here it doesn’t happen between the client and the server but between two servers in the back end. The Gateway Time-Out error page usually indicates slow communication between the two servers, and it can also happen that the higher-level server is completely down.
As 504 is a network problem in the background only people who have access to that network can solve it. As with other server-side HTTP errors, sometimes it’s enough to refresh the page a few minutes later to tackle the issue – of course only if the service providers work on the problem meanwhil.
Editor’s note: This is written by Anna Monus for Hongkiat.com. Anna is a web developer and code writer with an interest for science, artificial intelligence, and disruptive technologies.