Serve a specific set of error pages for different subdirectories

Posted by navitronic on Server Fault See other posts from Server Fault or by navitronic
Published on 2010-06-16T10:06:52Z Indexed on 2010/06/16 10:13 UTC
Read the original article Hit count: 266

Filed under:
|
|

I am currently trying to setup 2 different sets of Error documents for separate folders within a website.

I have 2 folders within the root of a site:

demo/
live/

Any requests that return 404's or 403's within the demo folder needs to load one set of pages for the Apache errordocuments, eg.

ErrorDocument 404 /statuses/demo-404.html
ErrorDocument 403 /statuses/demo-403.html

And the live needs to go to similarly name files.

ErrorDocument 404 /statuses/live-404.html
ErrorDocument 403 /statuses/live-403.html

So far I have tried placing an .htaccess file in both directories with the ErrorDocument directives setup pointing to the specific files, the 404 works fine and references the correct page. However, the 403s do not work and revert to the server default when trying to access forbidden folders within the demo directory, the logs indicate the following:

[Wed Jun 16 04:47:44 2010] [crit] [client 115.64.131.144] (13)Permission denied: /home/abstract/public_html/demo/xxx/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

Is this correct? Would apache revert to default because it is trying to look for the htaccess in a folder it doesn't have permission in? Why wouldn't it work it's way back through the folder tree? Can I make it do this?

© Server Fault or respective owner

Related posts about apache

Related posts about permissions