How to Setup My Own Directory Index Rules in htaccess to Allow/Block Special Folder Access?
Imagine I have a folder, inside it are a bunch of photos from my latest nude colony camp visit, and the extravagant shots in it and all, that I dont want just everyone to have access to when typing the main folder e.g. www.website.org/photos/
www.website.org/photos/my_first_nude_colony_camp_visit_00281.jpg
Now, is there any possibility, and if yes, whats the proper correct apache language, to have the following rules for my website using htaccess or other magical powers:
RULE1: By default, block access to the ftp-lookalike-free-file listings to any and all folder contents.
RULE2: When however a (hidden?) file named pass.port is present in that folder, then do allow ftp-lookalike free listing of all the contents.
That way I can make exception to which folders I want to let BE visible, and which better NOT. Thank you for your clues and suggestions!
To disable files listing for the directory and all sub-directories add to your .htaccess
Options -Indexes
To disable viewing files with a particular extension (for example, .port) add
<Files ~ "\.(port)$">
Order allow,deny
Deny from All
</Files>
精彩评论