views:

299

answers:

2

Hi.

In my root web folder I have a list of folders (files, modules, classes) that I'm using .htaccess to prevent access to. However, in the modules/ folder, there are modules that carry their own images, which I'd like to allow access to.

How do I allow access to images in a folder under modules/, but still prevent accessing any other files in that same directory path?

+1  A: 

Try this in your .htaccess. It should let you grant access to images within the directory. You may need to tweak this to make it work for you.

<FilesMatch "\.(gif|jpe?g|png)$">
Order allow,deny
Allow from all
</FilesMatch>
CRasco
Unfortunately that didn't work - probably because I have a 302 redirect in the main .htaccess file for that folder path - I can't see that it ever processes that sub-folder .htaccess file ...
Daniel Andre
Yes. If you are doing a 302 to deny access to these files then the request will never make it to this directory.
CRasco
A: 

Hi,

I believe if you read this document: http://httpd.apache.org/docs/1.3/howto/htaccess.html you will gain insight as to how to achieve the access permissions you desire.

To sum it up, without rewriting the document: you can allow access to the directories that you wish either through .htaccess files in those folders, and .htaccess files can be placed at any level in your directory tree.

Further, the article also makes some suggestions that may perform better by using your main server config file instead of .htaccess files.

Hope this helps, -james

arrocharGeek
Unfortunately I don't have access to the main config files, and I also couldn't find anything in there that could help solve the issue descrbibed. Thanks for the link though!
Daniel Andre