Using CGI to Create an Advanced Error Document

CGI offers you a lot of flexibility in creating custom error documents that you just don’t get from building a plain HTML error document. The problem with straight HTML is that no matter which page the user requested, or how he got to the page, he still gets the same error message. Through the use of CGI scripts, you can create dynamic error documents that provide customized content depending on what the user is looking for.

Environment Variables for Error Documents

When a CGI program is called as the result of an error, Apache (and other NCSA-compliant Web servers) set three environment variables that aren’t part of the normal CGI environment. These variables contain information about the user’s ...

Get Sams Teach Yourself CGI in 24 Hours, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.