httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Dessent <>
Subject Re: [users@httpd] ErrorDocument Gurus... read this
Date Tue, 05 Aug 2003 15:30:49 GMT
Jon Block wrote:
> I'm using the ErrorDocument directive to serve out a different file when
> files are not found in one of my directories. Everything is working, but I'm
> wondering if there is a way to serve out the error document file without
> returning a the 403 status code to the browser. The reason is because I want
> to have a certain series of pages be indexed by google and I seriously doubt
> that google will take them if they are 403's. The nice thing with these
> particular pages is that even if the files are not there when they are
> requested, the error document will serve out the content that should have
> been there so it is transparent to the end user.

You could specify a CGI script as the 403 (? did you mean 404 ?)
handler, and the script could supply whatever result code and headers
you want.  The script would know the path/filename that generated the
error by looking at one of the passed environment variables (REQUEST_URI
maybe, I forget) and use that to send the proper content.

For example, the 'lurker' mailing list software uses this trick -- you
setup the 404 handler for it's "cache" directory to point to the main
CGI script.  Then when a request comes in for content that has not been
generated, the script runs and generates the page, sends it to the
browser, and stores it as a static page so that the next time it's
requested Apache serves it directly & efficiently as a static file...
kind of a neat trick to cacheing dynamic content.  I think they have a
cron job to periodicly delete the cache contents to keep disk space
usage down.


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message