Reputation: 1023
I cannot make my 404 ErrorDocument work
This is my virtual host configuration:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName mydomain.com
ServerAlias landing.mydomain.com
DocumentRoot /var/www/html/mydomain.com/public_html
ErrorDocument 404 /var/www/html/mydomain.com/public_html/errors/404.html
</VirtualHost>
This are all 304:
mydomain.com/errors/404.html
mydomain.com
landing.mydomain.com
And this is a 404:
http://factuplus.com/noexists.html
Not Found
The requested URL /noexists.html was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Upvotes: 1
Views: 234
Reputation: 2400
Your ErrorDocument
path should be relative to the DocumentRoot
:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName mydomain.com
ServerAlias landing.mydomain.com
DocumentRoot /var/www/html/mydomain.com/public_html
ErrorDocument 404 /errors/404.html
</VirtualHost>
Optionally, you could use the full URL:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName mydomain.com
ServerAlias landing.mydomain.com
DocumentRoot /var/www/html/mydomain.com/public_html
ErrorDocument 404 http://factuplus.com/errors/404.html
</VirtualHost>
Upvotes: 0