1
votes

I have the following htaccess, directory listing is enabled, however when go to the directory the .htaccess file is in, there's no access control. what's wrong?

                                                                   
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /home/xxx/.htpasswd
AuthGroupFile /dev/null
require valid-user
3

3 Answers

0
votes

The solution is that I need to have AllowOverride All to allow .htaccess at the directory levels.

         <Directory /var/www/vhosts/localhost>
                Options Indexes FollowSymLinks
                 AllowOverride All
        </Directory>
0
votes

Try removing AuthGroupFile from there, perhaps it is causing trouble.

Everything else looks absolutely correct. One possibility is that your copy of Apache doesn't have the AuthConfig AllowOverrides enabled for your files. This would disable Auth* entries in .htaccess.

-1
votes

You must type to the top: RewriteEngine On

If that does not work, that means you may not have RewriteEngine at all