Web Hosting Geeks | Web Hosting Experts
Need help? Call us 1(866)TOP-HOST

14361 reviews 1715 hosting providers

Questions & Answers

Prevent Directory Listing

May 21, 2012 by TheRock
hello all

I have a website and I don’t want to allow users to view the files of a particular directory in such a direct way , and I want  prevent the listing of that directory. Does anyone know how can I do this?
Any help will be very much appreciated.
Thank you

2 Answers

0 votes
May 21, 2012 by WebGuru
Put the  following code into the .htaccess file
IndexIgnore *
If you place that .htaccess file in the root folder then direcotry listing is prevented of the sub-folder as well. And if you place the .htaccess file inside the “images” folder then directory listing are prevented of that particular directory only.
0 votes
May 21, 2012 by expert
it could also be done by adding the following line to your .htaccess file
IndexIgnore *
for example if you don't want to list “.gif and .zip” and then you can put the following code inside .htaccess.
IndexIgnore *.gif  *.zip