Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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.