Reputation: 845
My Directory structure is like this.
Root
|
assets
|-js
|-css
|-img
action
|a.php
|-b.php
include
|-inc1.php
|-inc2.php
I'm using Option Options -Indexes
in .htaccess file but i have to put this file in every directory. Is there a way i can use only one hraccess file and put rule on directories? Also i wanted to know .If i use htaccess will it stop my php file from accessing the resources from these directories?
Upvotes: 1
Views: 123
Reputation: 20771
Drupal uses this in the root directory to prevent client access to some files. "profile" and "module" are directories. [Correction: profile and module are directories, but in the Drupal expression below it is checked as an extension.]
# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format|LICENSE.txt)$">
Order allow,deny
</FilesMatch>
For you you'd want to change the matching rule to something like this:
<FilesMatch "^(assets|action|include)$">
Upvotes: 1
Reputation: 3197
It's normal to use just one .htacces file in the root directory. If you want to apply rules to particular directories without adding another .htaccess file, you may be able to apply rules based on the url if the url maps with the folders. It would be easier to help you if you provided a concrete example
Upvotes: 1