Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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)

share|improve this question

2 Answers 2

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

share|improve this answer
    
This is what I'm using currently, I haven't found a better, working way. –  user12657 Apr 5 '11 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.

share|improve this answer
    
Override those who want to be seen. –  topless Mar 27 '11 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 '11 at 13:04

Your Answer

 
discard

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.