2015-10-14 57 views
0

我想为网站密码保护只是web服务的URL保留所有。LocationMatch负面表达

这个表达式在Apache中完美工作,只需要转向对面。

<LocationMatch "^(.*service).*$"> 
     AuthType Basic 
     AuthName "Restricted Files" 
     AuthUserFile /storage/www/xxxxx/.htpasswd 
     Require valid-user 
</LocationMatch> 

我尝试了很多很多形式,但是不起作用。 我想这和reguler测试仪阿帕奇(2.2)

<LocationMatch "^(?!.*service).*$"> 

怎么能否定的表达完美地工作只是没有?

.htaccess内容如果有问题。

RewriteEngine on 
RewriteBase/


# .... 
RewriteRule  txxxx/(.*)  index.php?config=main_lite&r=script/xxx/deliverData&url=$1 

# rule 1 -- let these requests pass through (S=1 skips the next rule) 
RewriteCond %{REQUEST_FILENAME} favicon.(gif|ico) [NC,OR] 
RewriteCond %{REQUEST_FILENAME} .+\.(pdf|js|css|txt|jpg|jpeg|gif|png|bmp|ico|swf|html|log|svg|ttf|eot|woff|woff2)$ [OR] 
RewriteCond %{REQUEST_URI} rsc/ [OR] 
RewriteCond %{REQUEST_URI} index.php$ 
RewriteRule (.*) - [S=1] 

# rule 2 - pass every request to index.php 
RewriteRule .* index.php 
+0

我没有看到你的.htaccess任何密码保护。同时显示完整的 anubhava

+0

对不起,我添加了密码保护部分。 – Cipo

回答