htaccess排除文件需要auth

时间:2014-01-19 12:35:16

标签: .htaccess authentication except

我想要为除index.php

之外的所有文件使用auth

这是我的代码,但我不知道出了什么问题......

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 个答案:

答案 0 :(得分:1)

使用此

AuthName "Restricted Area"
AuthType Basic
AuthUserFile /var/www/.htpasswd

<Files "*">
Require valid-user
</Files>

<Files "index.php">
Allow from all 
Satisfy any
</Files>