仅限htaccess到index.php(没有子文件夹,文件等)

时间:2014-01-24 10:27:05

标签: .htaccess .htpasswd

我试图密码保护index.php(或html)文件但无法管理。无需密码即可访问子文件夹...

像...一样的东西。

<Files "/var/www/clientarea/index.php">

AuthUserFile /var/www/clientarea/.htpasswd
AuthName "Salasanasuojattu sivusto"
AuthType Basic
require valid-user

</Files>

1 个答案:

答案 0 :(得分:0)

试试这段代码:

SetEnvIfNoCase Request_URI "^/index\.(php|html?)" SECURED

AuthUserFile /var/www/clientarea/.htpasswd
AuthName "Salasanasuojattu sivusto"
AuthType Basic
require valid-user
Satisfy    any
Order      allow,deny
Allow from  all
Deny from env=SECURED