问题
I would like to require an auth for all files except index.php
here is my code but I don't know what's wrong...
AuthName "Restricted area"
AuthType Basic
AuthUserFile /var/www/.htpasswd
IndexIgnore */Network?Trash?Folder */Temporary?Items
Allow from 127.0.0.1
Allow from 192.168.0.254
Allow from ::1
Satisfy Any
<Files "*">
Require valid-user
</Files>
<Files "\index.php">
Order allow,deny
Allow from all
</Files>
回答1:
Use this
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /var/www/.htpasswd
<Files "*">
Require valid-user
</Files>
<Files "index.php">
Allow from all
Satisfy any
</Files>
来源:https://stackoverflow.com/questions/21216816/htaccess-exclude-file-require-auth