"private" directory not accessible in Apache

Posted by janeden on Server Fault See other posts from Server Fault or by janeden
Published on 2011-11-21T09:34:00Z Indexed on 2011/11/21 9:56 UTC
Read the original article Hit count: 186

Filed under:

The directory private lives under my DocumentRoot, and despite its name, it should be accessible just like any other dir. But if I add the following RewriteRule to httpd.conf:

RewriteRule ^/([^\.]+)$ /$1.html [L]

Apache returns 403 for http://server/private/2201. The error log states

client denied by server configuration: /private/2201.html

If I then rename private to foo, or if I request 2201.html directly, the file is served:

127.0.0.1 - - [21/Nov/2011:10:24:45 +0100] "GET /private/2201 HTTP/1.1" 403 214
127.0.0.1 - - [21/Nov/2011:10:24:58 +0100] "GET /foo/2201 HTTP/1.1" 200 3068
127.0.0.1 - - [21/Nov/2011:10:27:39 +0100] "GET /private/2201.html HTTP/1.1" 200 3068

This is confusing. Is there any special rule for directories named private? If so – why does the direct request for 2201.html work (although the denied request seems to handle the same resource, at least according to the error log entry)?

© Server Fault or respective owner

Related posts about apache2