I'm trying to set up custom error pages (403, 404, etc) on an Apache 2.2 setup. I know that on IIS7.5 the pages are stored in

%SystemDrive%\inetpub\custerr\en-US\404.htm

but am not sure where they are (or even if they exist) on Apache. Is there a .config file I need to change or something similar?

link|improve this question

Also, I've posted it on SF rather than webmasters.stackexchange as there's 4k+ questions tagged on SF for "apache" – tombull89 Feb 1 '11 at 12:33
feedback

2 Answers

up vote 3 down vote accepted

Usually such information is defined in your .htaccess. Eg:

ErrorDocument 500 http://foo.example.com/cgi-bin/tester
ErrorDocument 404 /cgi-bin/bad_urls.pl
ErrorDocument 401 /subscription_info.html
ErrorDocument 403 "Sorry can't allow you access today" 

More information: http://httpd.apache.org/docs/2.0/mod/core.html#errordocument

link|improve this answer
is this not for a per-site basis though? or is there a "master" .htaccess for all sites on that Apache install? – tombull89 Feb 1 '11 at 12:49
2  
On Apache, the .htaccess files provide overrides to the standard configuration - which is stored in httpd.conf - where that file is will depend on how your apache was compiled and options on the command line used to start it (have a look in the directory tree where you installed apache). The ErrorDocument must be within the current vhosts document tree - so it makes sense to either define this within the vhost config or via a .htaccess file. – symcbean Feb 1 '11 at 13:55
feedback

This is normally just within the default DocumenRoot for the server. While this may be a bad example, cPanel stores it's default 404's in /usr/local/apache/htdocs/

Stock configurations will also load them from wherever the default document root is for all of the other non-matching requests.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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