BigNoseBird.Com- home Small Logo
The 508 compliant Guide to 
       Big Nose Bird
BACK
WARNING: Be very careful editing your server configuration or .htaccess files. Even a minor typographical error can make your site unusable! Always make a backup copy of any file so you can recover quickly.

Redirecting Your Reader to a CGI script when an error occurs.

Redirecting your readers to a CGI script works exactly like sending them to an HTML page from their perspective, but it can be a timesaver for you as a webmaster.

By calling a script, you have the opportunity to both handle the reader, and log the information. This can help you track down problems a lot faster than searching through your logs for errors.

To redirect a reader to a CGI script 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 .htaccess file.

In the srm.conf file you will find a line that looks like this:

#ErrorDocument 404 /cgi-bin/missing_handler.pl

To specify a special script, remove the # mark and and provide the name of your script.

ErrorDocument 404 /cgi-bin/missing.cgi

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 specific script for each error code:

ErrorDocument 400 /cgi-bin/badreq.cgi
ErrorDocument 401 /cgi-bin/noauth.cgi
ErrorDocument 403 /cgi-bin/forbid.cgi
ErrorDocument 404 /cgi-bin/missing.cgi
ErrorDocument 500 /cgi-bin/conferr.cgi

Personally, I feel it a better idea to just have one script and pass the error code as the QUERY_STRING.

ErrorDocument 400 /cgi-bin/birdtrap.cgi?400
ErrorDocument 401 /cgi-bin/birdtrap.cgi?401
ErrorDocument 403 /cgi-bin/birdtrap.cgi?403
ErrorDocument 404 /cgi-bin/birdtrap.cgi?404
ErrorDocument 500 /cgi-bin/birdtrap.cgi?500

Want to know how to write such a script? We just happen to have one for you, BIRDTRAP! Of course its free!



Find or Give Help on the BBS
 
Home Top E-Mail
If it looks great, it's by Christine
Some Fine Print
© 1997-2003 BigNoseBird.Com®, Inc. All rights reserved. All other trademarks are the sole property of their respective owners. The products that we recommend are only ones that we use. We have no relationship with any of the authors or their companies. We cannot assume responsibility for their ultimate performance or lack of same. We also cannot assume responsibility for either any programs provided here, or for any advice that is given since we have no control over what happens after our code or words leave this site. Always use prudent judgment in implementing any program- and always make a backup first! For further information, please read our Privacy Statement. We can be contacted at webmaster@bignosebird.com.


<reallybig.com>
Web Builder Network Portal
Advertise
on the
Reallybig.com
Network
BigNoseBird Newsletter
Subscribe
Un-Subscribe


Sign up today to receive our low volume newsletter. Tips, tricks, news, and whatever else crosses our minds.
Back Issues
Privacy Statement