I have localhost/mySite/logs as password protected and it works using .htaccess and .htpasswd, but additionally I would like to have localhost/mySite to not list directory contents. I've tried doing this in /etc/apache2/apache2/apache2.conf:
<Directory "/www/var/mySite">
Options -Indexes
</Directory>
Currently I have this in /etc/apache2/sites-available/default:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
I can get around this by putting a blank index.html in /var/www/mySite but what is the other way using Options -Indexes? (I got from some where else that by default all files under /var/www ignore the .htaccess file so I changed the AllowOverride None to All in /etc/apache2/sites-available/default)
2 Answers
My dirty solution is to create an empty index.html file in each such directory.
-
This is what I'm using currently, I haven't found a better, working way. Apr 5, 2011 at 14:21
In /etc/apache2/sites-available/default, somewhere there you will hit:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
[...]
</Directory>
remove Indexes and I think you solved your problem.
-
-
That did not help. When I did remove "Indexes" and restart apache, I not only got
Forbidden You don't have permission to access /mySite/ on this server.
but I also couldn't access to `mySite/logs with the right user name and password, I got the same error. Mar 27, 2011 at 13:04