I've tried several cases for the ErrorDocument directive, and they break variously. (ETA: Actually, the http:// method works. Hooray!)
For the record, under httpd 1.3, the directive was
ErrorDocument 404 /redirect/notfound.php
within a <VirtualHost, referring to a "redirect" subdirectory within the webroot.
- Put the error document outside the webroot, such as in ../error/404.html.
Directive:
<VirtualHost>
ErrorDocument 404 /web/sph/error/404.html
</VirtualHost>
Note - all directives are within the virtualhost context. I started to experiment with the directory context, but I'm omitting that part since the results were the same.
Result:
A standard 404 with the note, "Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request."
Error_log:
[Wed Aug 13 19:39:27 2008] [error] [client 10.0.0.246] File does not exist: /web/sph/html/asf
[Wed Aug 13 19:39:27 2008] [error] [client 10.0.0.246] File does not exist: /web/sph/html/web
Where on earth is it getting that "web" part?? - Okay, well, let's try putting the errordoc directly in the webroot.
Directive:
ErrorDocument 404 404.html
Result:
It actually DISPLAYS THE WORDS "404.html".
Error_log:
[Wed Aug 13 19:42:17 2008] [error] [client 10.0.0.246] File does not exist: /web/sph/html/asf - Okay, let's put quotes around that last one.
Directive:
ErrorDocument 404 "404.html"
Result:
Same as above - Fine ... try same location, full path. With and without quotes.
Directive:
ErrorDocument 404 /web/sph/html/404.html
Result:
Same as #1
Error_log:
[Wed Aug 13 19:46:54 2008] [error] [client 10.0.0.246] File does not exist: /web/sph/html/asf
[Wed Aug 13 19:46:54 2008] [error] [client 10.0.0.246] File does not exist: /web/sph/html/web - Screw you, httpd.
- Okay, obviously something different is necessary. Try it with an URL.
Directive:
ErrorDocument 404 http://www.whereiwork.edu/errdoc/404.html
Result:
If the subdirectory was named "error", I got a warning about an impossible redirect. Since that wasn't coming from anything I'd configured, I guessed "error" was reserved for something and changed it to errdoc. At that point, I got the actual contents of the doc I wanted.
I'd like to understand how this directive is supposed to work, or find the bug report thereon, but I'd like much more to go home.