使用重写条件与允许和手托指令 [英] using rewrite condition with allow and Satisfy directive
本文介绍了使用重写条件与允许和手托指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个规则,允许以提示用户凭据,并重定向HTTP请求只有HTTPS请求。
I want to create a rule that allows only the https request to be prompted for user credentials and the http request to be redirected .
SetEnvIfNoCase IS_SSL .*yes.* HTTPS_REQUEST
<Files *>
AuthType Basic
AuthName "MyFirstPage"
AuthBasicProvider file
AuthUserFile /indexing/.pwd
Require valid-user
Order Deny,Allow
Allow from env!=HTTPS_REQUEST
Satisfy All
</Files>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{ENV:IS_HTTPS_REQUEST} off [NC]
RewriteCond %{THE_REQUEST} ^GET [NC]
RewriteRule ^(.*)/Mydata.php https://%{HTTP_HOST}/x1/Mydata.php [R=301,L]
</IfModule>
以上code被提示输入密码,HTTP和HTTPS请求。能否请你建议
The above code is prompting for the password for both http and https request . Can you please suggest
问候
推荐答案
您需要更改全部,以任意
You need to change "All" to "Any"
Satisfy Any
这样,如果在 ENV!= HTTPS_REQUEST
为真,需要有效的用户
不需要来满足。
That way if the env!=HTTPS_REQUEST
is true, the Require valid-user
doesn't need to be satisfied.
这篇关于使用重写条件与允许和手托指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文