[Linux-disciples] SSI and ErrorDocuments
Stephen R Laniel
steve at laniels.org
Sun Sep 12 11:26:54 EDT 2004
when someone visits /foo.html on a site that I've developed,
he's actually -- via mod_rewrite -- visiting
/template.shtml?foo.html. That, in turn, is an SSI page, and
foo.html is included with a '<!--#include' directive.
If foo.html doesn't exist, I'd like Apache to return a 404
error and display /error/404.html. The trouble is that
Apache doesn't return a 404 if one of the #included files
doesn't exist.
So that's my question: how do I get SSI to return a 404 when
one of the #included documents doesn't exist? Right now I've
got a hack going in mod_rewrite:
#if the file is HTML and doesn't exist, return the templated 404
RewriteCond %{REQUEST_FILENAME} \.html$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ error/404.html
But that doesn't actually return a 404 error, and
consequently I can't grep through my error.log file to find
all the nonexistent pages that people requested.
Any ideas?
--
``Nobody ever picks yellow out of the [crayon] box just for
the Hell of it, but once you start coloring in whatever
coloring book or colored coloring you colored, there's a
99.9% chance you'll eventually need the yellow for
something. In that I cheerfully liken it to bay leaves.''
-http://x-entertainment.com/articles/0913/
More information about the Linux-disciples
mailing list