A tutorial to disable directory browsing with an htaccess file. Note htaccess files only work on a Linux server
Letting people snoop around your directory's that don't have an index file in them can lead to security vulnerabilities. thankfully their is a simple solution to this problem by using an htaccess file.
By disabling directory browsing a user would see a forbidden page rather then the files inside that directory.
To create an htaccess file open notepad or any plain text editor and save the file as .htaccess, if using notepad make sure the file type is set to all files or you will create a txt file.
on the first line put an hash symbol '#' which enables you to put comments in the file. Then use the command Options -indexes which will disable directory browsing.
The final file will look like this:
#disable directory browsing Options -indexes
Save the htaccess file in the root of the server or in the directory when you want to disable directory browsing.
For the past 12 years, I’ve been developing applications for the web using mostly PHP. I do this for a living and love what I do as every day there is something new and exciting to learn.
In my spare time, the web development community is a big part of my life. Whether managing online programming groups and blogs or attending a conference, I find keeping involved helps me stay up to date. This is also my chance to give back to the community that helped me get started, a place I am proud to be apart of.
Besides programming I love spending time with friends and family and can often be found together going out catching the latest movie, staying in playing games on the sofa or planning a trip to someplace I’ve never been before.