Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a virtual server running apache2 on debian. I would like to create a default 404 error message in the apache2.conf for all my websites.

ErrorDocument 404 "/var/www/site/public/404.html"

The error I get after restarting apache is: Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

It works if I enter the URL although I dont want the page to redirect only use a default 404.html page.

share|improve this question
+1 for humorous irony – Chris S Aug 10 '11 at 17:14
I've never seen a 404 loop – Mike Aug 10 '11 at 17:19
I don't know whether to be happy with the vote ups or embarrassed it was a daft question. – John Magnolia Aug 10 '11 at 22:12
up vote 6 down vote accepted

You don't use the full path in ErrorDocument. Its relative to your htdocs root

if your root is /var/www/site/public/

ErrorDocument 404 /404.html

You can also do a full url

ErrorDocument 404


You can do this for each vhost then

Alias /404 /full/path/to/404.html
ErrorDocument 404 /404
share|improve this answer
Thank you, although is there anyway to do this without having to upload 404.html to each vhost website? Maybe I could add an alias for the 404.html, is this the best way? – John Magnolia Aug 10 '11 at 17:24
edited my answer for an alias in there – Mike Aug 10 '11 at 17:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.