Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

is it possible to list all files in directory ?

asdf.com/dir/

but dir has index.html in it, so when you navigate to it index.html pops up.

for precaution i have added

        IndexIgnore *
share|improve this question
    
So, do you want to show the listing despite existing index.html or prevent it from showing anyhow? –  Jawa Oct 27 '09 at 2:28
    
i want to prevent users being able ot view the directory listings. i have put index.html. for extra precaution i put indexignore * to hide all files in directory. –  ahahaha Oct 27 '09 at 2:47

1 Answer 1

Misunderstood your question -- the way I read it, it seemed that you wanted to list all the files in the directory. I've edited my answer below.

You need something like this in .htaccess or httpd.conf:

<Directory "/var/www/foo/dir">
    AllowOverride Indexes
    Options -Indexes
</Directory>

Attempting to list the contents of that directory will always result in 403 Forbidden.

Alternatively, you can put a blank index.html in there, and it will have the same effect. Users will not be able to view the directory listing. IndexIgnore is not explicitly needed.

share|improve this answer
    
does indexignore * not work ? –  ahahaha Oct 27 '09 at 2:47
    
Misunderstood your question (I thought you wanted the reverse). See my edited answer above. –  Sam Halicke Oct 27 '09 at 4:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.