2011-03-10 46 views
5

我有下面的代碼在.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> 

如何從這裏should_be_excluded.php排除被密碼保護? 如果需要,我可以更改保護線,但我認爲可以在正則表達式中完成某些操作?

回答

3

怎麼是這樣的:

<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> 

這應該允許ALL訪問排除的文件?

+0

這不行,你試過了嗎?如果是的話,你的工作是什麼版本的Apache,你覺得可能是什麼問題? – Centurion 2011-03-10 14:23:36

+0

@Centurion嘗試添加'滿意所有''下面'允許所有' – 2012-02-29 07:02:27