简体   繁体   English

从.htaccess中排除密码保护中的一个文件

[英]Exclude one file from password protection in .htaccess

I have the following code to protect files with password in .htaccess : 我有以下代码来保护.htaccess密码文件:

<FilesMatch "\.(html|htm|css|js|php|swf|swz|xml|ico|jpg|jpeg|png|txt)$">
AuthName "Member Only"
AuthType Basic
AuthUserFile /path/to/password/.htpasswd
require valid-user
</FilesMatch>

How can I exclude from here the should_be_excluded.php from being password protected? 如何从这里排除should_be_excluded.php受密码保护? I can change the protection lines if needed, but I think that something could be done in the regex? 如果需要,我可以更改保护线,但我认为可以在正则表达式中完成某些操作?

how about something like: 怎么样的东西:

<FilesMatch "\.(html|htm|css|js|php|swf|swz|xml|ico|jpg|jpeg|png|txt)$">
    AuthName "Member Only"
    AuthType Basic
    AuthUserFile /path/to/password/.htpasswd
    require valid-user
</FilesMatch>
<Files /should_be_excluded.php>
    Order Allow,Deny
    Allow from all
</Files>

this should allow ALL access to the excluded file? 这应该允许ALL访问被排除的文件?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM