0

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 2

1

My dirty solution is to create an empty index.html file in each such directory.

1
  • This is what I'm using currently, I haven't found a better, working way.
    – user12657
    Apr 5, 2011 at 14:21
0

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.

2
  • Override those who want to be seen.
    – topless
    Mar 27, 2011 at 10:03
  • 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.
    – user12657
    Mar 27, 2011 at 13:04

You must log in to answer this question.

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