Use .htaccess to block *All* access to specific folders.

Posted by Urda on Server Fault See other posts from Server Fault or by Urda
Published on 2010-03-19T13:17:18Z Indexed on 2010/03/19 13:21 UTC
Read the original article Hit count: 185

Filed under:
|
|
|

I am not sure how to do this, but I want to block all access to a specific set of folders on my web server. Say secret01 and secret 02...

homeDir
  |- data
  |- www
  |   |- .htaccess (file)
  |   |- images
  |   |- js
  |   |- secret01
  |   |- secret02
  |   |...
  |...

What rule(s) do I need to add to my root .htaccess file to do this? I want all access from the web blocked from going into these folders, period. Only way one could get to them would be over SFTP or SSH. So what rule am I looking for? I am preferably looking for a one-liner so I can add more folders or move it to another site down the road. I really would prefer if the rule could be placed in the .htaccess root file so I don't have to jump all over the place to lock and unlock folders.

© Server Fault or respective owner

Related posts about .htaccess

Related posts about blocking