From PHP guides to small marketing. From ePayments all the way through to BioTech. Your all-tech passport.

Jun 6, 2012

Prevent directory browsing using htaccess - Security tip!

If you visit a website like site.com/folder1/ it will display all its contents.
What if you had an inportant file in there, everyona can se it.
Dont worry, apache did for us!
Using a simple htaccess rule we can easily disable this option.

# this is a comment#this is the rule we must addOptions -indexes
Alright, when someone tryes to access that folder it will get an 403 Forbitten and not be able to watch the file.
An other way is to add at every folder and index.html but the first one is more fast :)