perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Randolf Richardson" <>
Subject Re: Mod Perl - Custom Error Pages
Date Tue, 25 Oct 2011 21:26:18 GMT
> For a while now my system has error trapped issues the it encounters
> and printed an error page with a 200 status code.
> Recently when my web developer started using AJAX, this became a
> problem, be cause he couldn't check for error codes on the pages. So I
> updated my error routine to pass proper error code like:
> print "Content-type: text/html\n";
> print "Status: 400 Bad Request", "\n\n";
> The problem I am however encountering is my custom error page
> generated by the perl script is displayed and then bellow it on the
> same page is the error page defined in the apache conf for that code.
> The reason I want the mod perl to generate the error page is I want to
> be able to pass error info in the html comments.
> Is there a way to tell get mod perl to tell apache to not send the
> default page also?

	Yes, you can use the ErrorDocument directive to specify a perl 
script that's a part of your web site (instead of a .html page).

	I wrote a document that includes an example of the 404 handler perl 
script, here:

		ยง 404 Not found handler

	The entire guide, which also explains how to configure the <Files> 
stanza to handle .pl files, begins here:

		How to install and configure ModPerl 2

	 (I use this approach with my web sites, and I'm aware of a few 
people who've followed the instructions in my guide to get ModPerl 2 
up-and-running for their projects.)

	Please note:  I'm not suggesting that you set up your site in the 
same manner as mine {as there is typically more than one way to do 
things in Perl}, but I'm hopeful that this can at least provide you 
with some ideas that will help you create the best solution.

Randolf Richardson -
Inter-Corporate Computer & Network Services, Inc.
Beautiful British Columbia, Canada

View raw message