Knowledgebase

The most common HTTP error codes

Here we'll list some of the most common server and client error numbers and we'll provide a short explanation of what each error number stands for. These can also be referred to as HTTP (Hyper Text Transfer Protocol) response status codes. Most of the status codes, however, are not for errors. In this article we'll concentrate on the most common error status codes.

After a client makes a request to a server and for some reason the request cannot be fulfilled these codes are returned to the client's browser. Each code stands for some particular reason of why the request could not be fulfilled. In some cases there can be dozens of reasons for a particular error code.

  • 401 Unauthorized-as the name suggests this error is returned when the client is required to provide a username and password in order to be able to access a page, but hasn't done so. For example, you can password-protect directories on your hosting account; when a visitor wants to access the URL corresponding to the directory but fails to provide valid login credentials, this will result in a 401 error code.
  • 403 Forbidden-this error code is returned to the client when they don't have permission to access the particular file/folder. The requested URL address exists and is valid, but protected in some way. For example, the file and folder permissions on the hosting account might be set in such a way that denies access to the particular file/folder for visitors. You can also block access to folders and files on your hosting account by blocking a particular IP address (or a whole network of IP addresses); when a client with a blocked IP address tries to access the protected folder/file, they will receive the 403 error code.
  • 404 Not Found-this error code is returned when the requested page does not exist. For example, somebody tries to open yourdomain.com/categories.php but you don't have a categories.php file in the public_html directory on your hosting account. In this case a 404 error code will be returned to the client. Many sites have a 404 error page to which all 404 errors are redirected.
  • 500 Internal Server Error-this is a common error code, and unfortunately it is one of the most ambiguous ones since there can be many reasons for this error. Although the name of the error implies that there's something wrong with the server, very often the reason is within the files and folders on your hosting account. For example, there may be errors with the code of scripts. There may also be syntax errors in your .htaccess files. If you use directives in an .htaccess file for an Apache module that's actually not installed, this will also produce an internal server error. More information about a particular error can be found in the server logs.

The text message in bold (e.g. forbidden, not found, etc.) that's after the error number is usually the default text that's displayed for the particular error. There can be slight differences in terms of the exact wording. Often the error code itself in not displayed.

You can change the text that's shown for an error code, or you can redirect all errors from a particular code to a specific page. For example, you can redirect all 404 Not Found errors to a page that's specifically designed for this purpose. You can do this with the help of .htaccess files. For more information check out the article on changing error messages and redirecting errors.

Was this answer helpful?

 Print this Article

Also Read