Directory listing

Directory listing

Posted by: Thomaspf
Posted on: 2007-06-04 11:45:00

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

Re: Directory listing

Posted by: scjessey
Posted on: 2007-06-04 11:59:00

Put the following in your .htaccess file:

Options -Indexes

--------
si-blog | Keystone Websites
Save $97 on yearly plans with promo code SCJESSEY97

Re: Directory listing

Posted by: al-khowarizmi
Posted on: 2007-06-04 21:14:00

Is that recursive to subdirectories?

Re: Directory listing

Posted by: Raz2133
Posted on: 2007-06-04 22:30:00

In reply to:

Is that recursive to subdirectories?


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

Mark

Re: Directory listing

Posted by: speirs
Posted on: 2007-06-07 03:25:00

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.

Re: Directory listing

Posted by: Raz2133
Posted on: 2007-06-07 05:16:00

In reply to:

Can I create one?


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.

In reply to:

What should be in it?


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

Options -Indexes

Mark

Re: Directory listing

Posted by: speirs
Posted on: 2007-06-07 07:38:00

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]$

Re: Directory listing

Posted by: Raz2133
Posted on: 2007-06-07 07:58:00

In reply to:

This doesn't seem to work.


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

Re: Directory listing

Posted by: coolgeek
Posted on: 2007-06-07 08:17:00

this works for me:

IndexIgnore *

Re: Directory listing

Posted by: speirs
Posted on: 2007-06-08 05:48:00

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

Tags: directory listingthank you in advance