Ajo*_*hew 4 iis url-rewriting url-rewrite-module
我已经编写了一条规则来根据用户代理重定向请求.
该规则设置为将默认请求(非移动)重定向Domain1到移动域和移动域的请求Domain2.
目前,即使在应用移动重定向后,所有来自移动设备的请求都将被用于Domain1
查找下面的重定向规则.谁能告诉我我错过了什么?
<rewrite>
<rules>
<rule name="Mobile UA redirect" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_USER_AGENT}" pattern="^.*BlackBerry.*$ " />
<add input="{HTTP_USER_AGENT}" pattern=".*Mobile.*Safari" />
</conditions>
<action type="Redirect" url="MobileURL" />
</rule>
<rule name="Claritinchallenge to" enabled="true" stopProcessing="true">
<match url="(.*)" />
<action type="Redirect" url="Second Domain" appendQueryString="false" />
<conditions>
</conditions>
</rule>
</rules>
</rewrite>
Run Code Online (Sandbox Code Playgroud)
在您的Mobile UA redirect规则中,条件逻辑分组是默认情况下的条件:MatchAll
我不认为HTTP_USER_AGENT匹配的手机^.*BlackBerry.*$也会匹配.*Mobile.*Safari.所以你需要将逻辑分组更改为MatchAny.
你的规则是:
<rule name="Mobile UA redirect" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_USER_AGENT}" pattern="^.*BlackBerry.*$ " />
<add input="{HTTP_USER_AGENT}" pattern=".*Mobile.*Safari" />
</conditions>
<action type="Redirect" url="MobileURL" />
</rule>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7568 次 |
| 最近记录: |