[thelist] Default 404 for all Apache Virtual Hosts

Noah St. Amand noah at tookish.net
Wed Oct 29 16:23:05 CDT 2008

I'm trying to figure out a way to have a single default 404 page for  
all of my virtual hosts, without having to have duplicate copies of  
that error page within each host's document root.

I thought I had it working fine with this in my apache2.conf:

ErrorDocument 404 http://example.com/404.html

But I just found out that when I use an absolute URL there, the  
browser gets a 302 (redirect) code followed by a 200 (success) code  
(as per <http://httpd.apache.org/docs/2.2/mod/ 
core.html#errordocument>) -- I want the browser to get a 404.

If I drop the "http://example.com", Apache looks for the error  
document relative to each virtual host's root, so I need to have a  
separate copy of it for each virtual host (or else set up a pile of  

Has anyone encountered this before? Any ideas how to make it work?


More information about the thelist mailing list