简体   繁体   中英

htacess file not working

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

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 .

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>

You must type to the top: RewriteEngine On

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM