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>
Probably your Apache has been configured in
httpd.conf
withAllowOverride
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?In case anyone else hits the same problem, the problem was that I'd copied and pasted in the line:
And Apache couldn't cope with the encoding of the hyphen!