Monday, February 7, 2011

How do I configure custom error messages?

To configure a custom error page, you must create a file called .htaccess

The name of the file is important.  Ensure after you have uploaded the file that the file name is in fact .htaccess and not .htaccess.txt.
Using a text editor such as Windows Notepad or Mac’s Textmate, enter the following line in a new file:
This will redirect any visitor to your web site to the URL you have entered, in this example that url is http://www.yourdomain.com/404.html.

Common error numbers

Here are the common error numbers and what their meaning is so that you may tailor your error pages accordingly.
  • 401: Authorization Required
    A password protected area of the web site was accessed, but the correct user name and password were not provided.
  • 403: Forbidden
    The page is being blocked by the web server and the visitor is not allowed to see it.
  • 404: Page Not Found
    The page that the visitor was attempting to access does not exist.  This is typically a broken link or an old web page that has since been removed.
  • 500: Internal Server Error
    There are a number of reasons for this error, however they are all due to an error within the web server where a script or application has crashed and the web server could not handle the error gracefully.