0

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.

Allyl Isocyanate
  • 299
  • 1
  • 4
  • 9

2 Answers2

3

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:

http://httpd.apache.org/docs/2.2/mod/core.html#errordocument

cjc
  • 24,533
  • 2
  • 49
  • 69
2

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

ErrorDocument 404 /error.html
ErrorDocument 403 /error.html
erikxiv
  • 147
  • 2
  • 12