How to block access to files in the current directory with .htaccess
- by kfir
I have a few private files in a public folder and I want to block access to them.
For example lets say I have the following files tree:
DictA
FileA
FileA
FileB
FileC
I want to block access to FileB and FileA in the current directory and allow access to the FileA in the DictA directory. The first thing that came to mind was to use the FilesMatch directive as follows:
<FilesMatch "^(?:FileA)|(?:FileB)$">
Deny from all
</FilesMatch>
The problem here is that FileA inside DictA will also be blocked, which is not what I wanted. I could override that by adding another .htaccess file to DictA but I would like to know if there is a solution which wont involve that.
P.S: I can't move the private files to a separate folder.