IIS URL重写模块:基于QueryString的重定向 [英] IIS URL Rewrite Module : Redirect Based On QueryString
本文介绍了IIS URL重写模块:基于QueryString的重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在根据查询字符串参数重定向到另一个URL时遇到一些问题。我想将输入www.domain.com/signup.aspx?p=1的用户重定向到:
I Have some problems with redirecting to another URL based on the query string parameters. I want to redirect users which enter www.domain.com/signup.aspx?p=1 to:
www.domain.com/signup
www.domain.com/signup
<rule name="Signup Redirect 1" stopProcessing="true">
<match url="signup\.aspx\?p=1" />
<conditions logicalGrouping="MatchAll" />
<action type="Redirect" url="signup" redirectType="Temporary" />
</rule>
现在当他们进入www.domain.com/signup.aspx?p=2他们必须去:
Now when they enter www.domain.com/signup.aspx?p=2 they must go to:
www.domain.com/signup/promocode
www.domain.com/signup/promocode
<rule name="Signup Redirect 2" stopProcessing="true">
<match url="signup\.aspx\?p=2" />
<conditions logicalGrouping="MatchAll" />
<action type="Redirect" url="signup/promocode" redirectType="Temporary" />
</rule>
以上规则不起作用。这样做的正确方法是什么?提前致谢。
The above rules don't work. What is the right way to do this? Thanks in Advance.
Gr
Martijn
推荐答案
看看这是否有效:
<rule name="Signup Redirect 1" stopProcessing="true">
<match url="signup\.aspx$" />
<conditions>
<add input="{QUERY_STRING}" pattern="p=1" />
</conditions>
<action type="Redirect" url="signup" redirectType="Temporary" />
</rule>
<rule name="Signup Redirect 2" stopProcessing="true">
<match url="signup\.aspx$" />
<conditions>
<add input="{QUERY_STRING}" pattern="p=2" />
</conditions>
<action type="Redirect" url="signup/promocode" redirectType="Temporary" />
</rule>
这篇关于IIS URL重写模块:基于QueryString的重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文