views:

226

answers:

1

I want to block people from accessing every directory except for /sandbox, /WebDev and /Projects

I tried this:

<Directory ^/(?<!sandbox|Projects|WebDev)+(/.*)>
    Order Deny,Allow
    Deny from all
</Directory>

but it gave a 500 error.

+1  A: 

The canonical way is something like:

<Directory />
    Order Deny,Allow
    Deny from all
</Directory>

<Directory /sandbox>
    Order Deny,Allow
    Allow from all
</Directory>

<Directory /WebDev>
    Order Deny,Allow
    Allow from all
</Directory>

<Directory /Projects>
    Order Deny,Allow
    Allow from all
</Directory>
Stobor
yeah, that makes sense but I was hoping that there would be a quicker regex way to add it faster. If there aren't any other answers this would work for sure.
Ramblingwood
it works though! thanks.
Ramblingwood