I have an Apache 2 server and it have several vhosts with similar definition:
<VirtualHost *:80> DocumentRoot /var/www/html/host1/ ServerName host1.loc <Directory /var/www/html/host1> AllowOverride FileInfo Options AuthConfig </Directory> ErrorDocument 404 /index.php?error=404 </VirtualHost> <VirtualHost *:80> DocumentRoot /var/www/html/host2/ ServerName host2.loc <Directory /var/www/html/host2> AllowOverride FileInfo Options AuthConfig </Directory> ErrorDocument 404 /index.php?error=404 </VirtualHost> ... <VirtualHost *:80> DocumentRoot /var/www/html/hostN/ ServerName hostN.loc <Directory /var/www/html/hostN> AllowOverride FileInfo Options AuthConfig </Directory> ErrorDocument 404 /index.php?error=404 </VirtualHost>
I would like to customize page 404.
The problem is that when I try to test 404 page in any of the hosts, I can see the page from the very last vhost. What could be wrong with my config?
ErrorDocument 404 "File not found on vhost hostN"
? Do you get the right messages? Try placing theErrorDocument
directive inside of theDirectory
directive.