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'd like to disable directory indexing on Apache.

This is my .htaccess file in full. But as soon as I uncomment Options -Indexes the server falls over.

What am I doing wrong?

#Options –Indexes

<IfModule mod_expires.c>

# Turn on the Expires engine
  ExpiresActive On

# CSS and JavaScript
  ExpiresByType text/css                  "access plus 1 hour"
  ExpiresByType application/javascript    "access plus 1 hour"

# Media: images
  ExpiresByType image/gif                 "access plus 1 month"
  ExpiresByType image/png                 "access plus 1 month"
  ExpiresByType image/jpg                 "access plus 1 month"
  ExpiresByType image/jpeg                "access plus 1 month"

# Webfonts
  ExpiresByType application/x-font-ttf    "access plus 1 month"
  ExpiresByType font/opentype             "access plus 1 month"
  ExpiresByType application/x-font-woff   "access plus 1 month"
  ExpiresByType image/svg+xml             "access plus 1 month"
  ExpiresByType application/ "access plus 1 month"

  <IfModule mod_headers.c>
    Header append Cache-Control "public"

share|improve this question
In what manner does the server fall over - what error messages to you see ? – Iain Nov 18 '11 at 13:11

Probably your Apache has been configured in httpd.conf with AllowOverride set to such values it does not allow you to tune any options in .htaccess.

Do you have access to httpd.conf or Apache error log?

share|improve this answer
up vote 2 down vote accepted

In case anyone else hits the same problem, the problem was that I'd copied and pasted in the line:

Options –Indexes

And Apache couldn't cope with the encoding of the hyphen!

share|improve this answer

Your Answer


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.