-1

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/vnd.ms-fontobject "access plus 1 month"

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

</IfModule>
1
  • 1
    In what manner does the server fall over - what error messages to you see ?
    – user9517
    Nov 18, 2011 at 13:11

2 Answers 2

2

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?

2

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!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .