Michael Michael - 24 days ago 5
Apache Configuration Question

htaccess adding password while enabling directories view in browser

Okay this might be a very obvious one however...

I have the following in my .htaccess file

AuthType Basic
AuthName "Message"
AuthUserFile /www/sites/5ce/448/domainname/folder.htpasswd
require valid-user


Which works fine for password protecting the folder it's placed in.

I also have in another .htaccess file (when I remove the first one)

Options +indexes


Which works fine for showing the directory folder and included files on browser.

When I put these together i get Error 500. How do you essentially enable directory view but password protected?

Answer

There shouldn't be a space between the + and the indexes.
Try this:

AuthType Basic
AuthName "Message"
AuthUserFile /www/sites/5ce/448/domainname/folder.htpasswd
require valid-user
Options +Indexes 
Comments