htaccess exclude file require auth

夙愿已清 提交于 2019-12-11 08:33:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!