URL重写重定向到同一页面

时间:2014-02-12 22:32:03

标签: asp.net iis-7 url-rewriting

我使用URLRewrite模块在web.cinfig中设置了重定向规则。

请参阅Rule1和Rule2获得相同的页面名称(Contact.aspx),但页面位于不同的文件夹中,应重定向到不同的位置。相反,一切都将成为'Rule1'的目标。 有人看看它并帮我解决这个问题吗?

<rule name="Rule1" patternSyntax="ECMAScript" stopProcessing="true">
    <match url="Service/Contact.aspx/?" />
    <action type="Redirect" url="http://www.samplesite.com/me-two/help/contact" appendQueryString="false" redirectType="Permanent" />
</rule>
<rule name="Rule2" patternSyntax="ECMAScript" stopProcessing="true">
    <match url="Commercial/Service/Contact.aspx/?" />
    <action type="Redirect" url="http://www.samplesite.com/commercial/help/contact" appendQueryString="false" redirectType="Permanent" />
</rule>
<rule name="Rule3" patternSyntax="ECMAScript" stopProcessing="true">
    <match url="Service/Contact.aspx/?" />
    <action type="Redirect" url="http://www.otherwebsite.com/commercial/help/contact" appendQueryString="false" redirectType="Permanent" />
</rule>

1 个答案:

答案 0 :(得分:1)

在网址开头尝试上限符号

<match url="^Service/Contact.aspx/?" />
相关问题