0

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?

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

2 Answers 2

3

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

2
  • is this not for a per-site basis though? or is there a "master" .htaccess for all sites on that Apache install? Commented Feb 1, 2011 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. Commented Feb 1, 2011 at 13:55
2

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.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.