htaccess排除文件需要身份验证 [英] htaccess exclude file require auth

查看:88
本文介绍了htaccess排除文件需要身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要求对除index.php以外的所有文件进行身份验证

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>


推荐答案

使用此

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

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

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

这篇关于htaccess排除文件需要身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆