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?
Put ErrorDocument directives inside Directory tag.
Trunk: https://httpd.apache.org/docs/trunk/custom-error.html
2.2: https://httpd.apache.org/docs/2.2/mod/core.html#errordocument
Use an html file instead of php one.