Directory ON-OFF using Htaccess

If you have no index or default page in a specific directory, a visitor may be served with a full list of files that the directory contains. This is usually not a good idea as it could pose a security risk. To counter this effect, add this to the htaccess file.

Options -Indexes

Another way to turn off an index listing is :

IndexIgnore *

That states the directory should not list “all” files. The star symbolizes all files.
Just the opposite situation may arise too. If you really do want directory listing to happen but the main server settings have it turned off, you may turn it on like this :

Options +Indexes

To have a directory listing turned on BUT have no image files showing :

IndexIgnore *.gif *.jpg

So any files that do not have a GIF or JPG extension on them would be allowed to be listed.

Written by 

I am Sakthivel Madesh, a certified Salesforce Advanced Developer & Administrator working on Salesforce Technology since 2011. I am currently working in Techforce Services as Sr. Salesforce Developer. I have worked on multiple technologies Like PHP, Java, Salesforce, I am very passionate about Salesforce and to earn 15x Salesforce Certification. I love Trailhead for learning Salesforce Skill and Become a Trailhead 5x Ranger too. I Love to Learn & Share my Salesforce knowledge to Salesforce Learners/Beginner using My Blog and Salesforce Community.

Leave a Reply