httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Freek Dijkstra <>
Subject Re: [users@httpd] allow autoindex for a directory, but not for its subdirectories
Date Mon, 23 Aug 2010 20:57:09 GMT
Freek Dijkstra wrote:

> Steps to reproduce
> 1. Add the following configuration to httpd.conf:
> Alias /test/ /var/www/test/
> <Directory "/var/www/test/projects">
>     Options Indexes
>     Order deny,allow
>     Deny from all
> </Directory>
> <Directory ~ "/var/www/test/projects/$">
>     Allow from all
> </Directory>
> Expected results:
> - requesting http://localhost/test/projects would give an autoindex
> - requesting http://localhost/test/projects/subdir would give a 403
> Forbidden
> Actual results:
> - requesting http://localhost/test/projects gives a 403 Forbidden
> - requesting http://localhost/test/projects/subdir gives a 403 Forbidden

For what it's worth, I'll follow the progress and will strive to get it
fixed, but can not easily upgrade this particular server.

Fortunately, there is a workaround for those who want to achieve
behaviour as I originally intended:

Alias /projects/ /var/www/test/projects/

<Directory "/var/www/test/projects/">
    Options Indexes
    Order allow,deny
    Allow from all

<Directory ~ "/var/www/test/projects/.+/">
    Order deny,allow
    Deny from all

<Directory ~ "/var/www/test/projects/subdir1/">
    Allow from all

- Requesting is allowed.
- Requesting is allowed.
- Requesting is not allowed.
This was exactly what I wanted.

For those implementing this workaround, be very careful about:
* Add the ~ in the last directive. It may seem superfluous, but is in
fact essential. Without it, the parsing order would change, as explained
* Add the / in the folder of the last directive. Without it, the parsing
order would change, so that the other regexp would prevail.


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message