How can I configure custom error pages?
The default server error pages are somewhat unimaginative, and provide very little help to users other than an error code which they often will not understand. Custom error pages provide a way for you to display rather more useful and interesting pages when an error occurs, such as a user requesting a document which does not exist. The error page could also redirect visitors to the main start page of the site.
Custom error pages are defined by using .htaccess files, which specify the location of the error document for the server to display, and the circumstances under which to display it. The .htaccess file should be a plain text file, which you can create using Notepad on Windows.
Example .htaccess File:
ErrorDocument 403 /errors/403.html
ErrorDocument 404 /errors/404.html
ErrorDocument 500 /errors/500.html
The ErrorDocument directive requires that you specify the error code for which to display the specified error document, and the error document to display. Each situation which causes an error has a corresponding error code. The most common error code is ‘404’ which is ‘Document not found’, this is generated when a client requests a file on the server which does not exist. The third item on each line specifies the document which the server returns when that error occurs. The error code ‘500’ is ‘Internal Server Error’ when something unexpected happens, and ‘403’ is ‘Forbidden’, when a client requests something for which it is not authorised.
If you are already have a .htaccess file with other directives, such as those for password protection, you can add the error document directives before or after the existing configuration data.
Further information on HTTP status codes can be found in the HTTP 1.1 RFC: http://www.ietf.org/rfc/rfc2616.txt