rooneyl has asked for the wisdom of the Perl Monks concerning the following question:

Hello all, I would like to use a single perl script to handle all the error pages for my apache web server. To do so it would need a variable to be passed into the script (I would imagine). If this is the case could someone tell me what it is called and the data type (would it be 404, or "not found"). If it helps I am using apache 2.2.6, with mod_perl, perl 5.8 The error document directive is set to; ErrorDocument /cgi-bin/error.cgi Thank you in advance for any help given.
  • Comment on Perl script to generate apache error pages

Replies are listed 'Best First'.
Re: Perl script to generate apache error pages
by wfsp (Abbot) on Feb 19, 2008 at 16:28 UTC
    According to the apache docs the syntax for ErrorDocument is
    ErrorDocument error-code document
    So it looks as though you could do it yourself
    ErrorDocument 404 /cgi-bin/error.cgi?error=404 ErrorDocument 500 /cgi-bin/error.cgi?error=500 ErrorDocument 403 /cgi-bin/error.cgi?error=403 ErrorDocument 401 /cgi-bin/error.cgi?error=401
    update: after further digging it looks as though you need to take account of Custom error responses and redirects too.