Joakim
Joakim

Reputation: 188

Allow access to a directory

I've can easely find a lot of .httaccess blocking examples, but in my case I would actually do the quit opposite, and allow access from all in subfolders matching (^|/)/thumbs/(/|$)

If you have a directory named 'blah' that you want to block, but it can occur anywhere in your directory tree, use the following: RewriteEngine On RewriteRule (^|/)blah(/|$) - [F]

Any body who know how to accomplish this?

Upvotes: 4

Views: 36814

Answers (1)

user2493235
user2493235

Reputation:

Well if you to want to allow /thumbs/ directories, it depends how they are being blocked in the first place. If they're blocked with normal Apache access permissions, then something like this will do it, but must go in the main server config at root level or in a <VirtualHost> and not in a .htaccess file.

<DirectoryMatch "/thumbs/">
    Require all granted
</DirectoryMatch>

Or for Apache before 2.4:

<DirectoryMatch "/thumbs/">
    Order allow,deny
    Allow from all
</DirectoryMatch>

Allowing is quite different from blocking with a forbidden response that you cited. You have to ask why is it not already allowed if it's within the web document root? Then open up that block.

Upvotes: 7

Related Questions