Directory listing


#1

Hi for sure 1000 times asked but the search does not give me an answer.
How can I prevent directory listing for my whole site?
I don´t want to place in each directory an index.html
Thank you in advance
Thomas


#2

Put the following in your .htaccess file:

Options -Indexes--------
si-blog | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#3

Is that recursive to subdirectories?


#4

Yes it is. Unless of-course, you override it with another .htaccess directive in the sub-directory itself.

Mark


Web Hosting Reviews | DreamHost Promo Code


#5

Exactly what I was looking for! But… I do not have a .htaccess file, or so it seems. Can I create one? What should be in it?

Thanks.


#6

Yes, just create a file called .htaccess and upload it to the web-directory for your domain. Note, if you are using Windows you might have problems creating a file called .htaccess, if so, just create one called htaccess.txt and rename it after uploading it to your server.

Just the directives you need, in this case a single line of text as follows;

Options -Indexes

Mark


Web Hosting Reviews | DreamHost Promo Code


#7

Hi Mark. This doesn’t seem to work. I can upload it fine but can still view the contents of a directory. What am I missing?

This is the output from ssh so you can see the file is in place:

[saltine]$ more .htaccess
Options -Indexes
[saltine]$


#8

Have you placed the file in the web-directory for your domain? By default this web-directory will have the same name as the domain (eg: yourdomain.com).

Mark


Web Hosting Reviews | DreamHost Promo Code


#9

this works for me:

IndexIgnore *


#10

Thanks guys, placed it in the wrong dir, it’s OK now.