Our web server configurations now support the implementation of custom error documents for your web site. Instead of a plain old 404 Not Found error simply stating the file doesn't exist, you can present maybe a link to a contents page or a search facility.
.htaccess
To implement a custom "File Not Found" error you need the following line present in the .htaccess file in the directory:
ErrorDocument 404 /404.html
That would tell the web server software to send 404.html to the client when it encounters a file not found error. To allow for different error codes you can specify the errorcode as the first argument after ErrorDocument. For example you could deal with a 403 forbidden error with:
ErrorDocument 403 /forbidden.html
(of course providing forbidden.html exists and contains text relevant to the error)
Please note that the ErrorDocument directive specified in a .htaccess file affects all directories beneath it, so you need only one .htaccess file in your www directory to implement custom error responses for your entire site.
Status Codes
400 - BAD_REQUEST
401 - AUTH_REQUIRED
403 - FORBIDDEN
404 - NOT_FOUND
500 - SERVER_ERROR
501 - NOT_IMPLEMENTED
The error codes which will probably be the most useful to you are:
404- file not found
401 - authorization required
403 - access forbidden
500 - server error
The server presents a 401 error when a user has attempted to access a password-protected area of a site and has failed to enter the correct details in the username/password box.
A 403 error is shown when the client is completely forbidden from accessing the specified file.
Lastly, a 500 error is usually encountered upon attempting to execute a cgi program. Usually this error is due to misconfiguration of a cgi/perl script. |