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'd like to know how to configure Apache 2 to specify the same error documents for both 403 (Forbidden) and 404 (Page Not Found) responses. I assume there is a directive to add to httpd.conf, but not sure what it is.

Most of the tutorials I see for doing this are based around .htaccess files, but I want to set this directive globally.

share|improve this question
up vote 3 down vote accepted

Add in a block like:

ErrorDocument 403 /40x.html
ErrorDocument 404 /40x.html

into the server or virtualhost configuration.

Here's the relevant section of the documentation:

share|improve this answer

You can set this globally in httpd.conf with the ErrorDocument directive

ErrorDocument 404 /error.html
ErrorDocument 403 /error.html
share|improve this answer

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.