Redirecting Your Reader to Special HTML Pages when an error occurs.
Rather than showing a simple text message when an error occurs,
displaying a friendly message along with a link to follow back
to a real page is a nice touch. I suggest that you keep the message
brief and polite. Do not consider every user caused error some type
of intrusion attempt. Anyone poking around with any knowledge of
how a server works will realize that you are properly handling and
possibly monitoring such activity.
To redirect a reader to a special web page
when they encounter an error, you can either modify the
srm.conf file if you have
the ability to do so, or to modify your
In the srm.conf file you
will find a line that looks like this:
#ErrorDocument 404 /missing.html
To specify a special web page, simply remove the # mark and
create a document called missing.html in your main HTML
ErrorDocument 404 /missing.html
You can name the files whatever you wish, and you might consider
placing all of them in a special directory. I have never tried
running the server configured for URL redirect without first
creating the error documents. Who knows what would happen if
the missing file was itself- missing!
If you do not have access to the master system files, you can add
the line as shown above to your .htaccess
file. In order for this to work, the system administrator must make
certain that the AllowOveride option called FileInfo is set. You should
try to obtain AllowOveride All on your directories.
You can of course have a special file for each error code:
ErrorDocument 400 /errors/badreq.html
ErrorDocument 401 /errors/noauth.html
ErrorDocument 403 /errors/forbid.html
ErrorDocument 404 /errors/missing.html
ErrorDocument 500 /errors/conferr.html
You can also redirect people off of your site using an external URL.
ErrorDocument 403 http://www.fbi.gov/
It's up to you if you want to send people accessing forbidden
URLs to the FBI!