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.

I am trying to stop directory indexing for a specific directory in Apache (Ubuntu) and have put the following in my .htaccess file:

<Directory /var/www/xyz>
    Options -Indexes
</Directory> 

This blocks the whole site. Why?

share|improve this question

2 Answers 2

Because Options -Indexes in .htaccess is recursive, is equivalent to

<Directory /your/root/>
    Options -Indexes
</Directory>

If you want to disable index only for a specific directory without recursion just put an empty index.html file there and ensure that DirectoryIndex directive is set to index.html.

share|improve this answer

And you put the .htaccess file in the directory which you want to disable?

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.