我有一个URL Rewrite,它可以很好地工作但是当你把"/"
放到最后它不起作用时......
我如何计算出这些网址...请建议
<rewriteMap name="Survey2013">
<add key="/discount" value="/survey/store/" />
<add key="/discount/" value="/survey/store/" /> // i have to add this URL as well
<add key="/discounts" value="/survey/store/" />
<add key="/discounts/" value="/survey/store/" />
</rewriteMap>
<rule name="Redirect for Survey2013" enabled="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{Survey2013:{REQUEST_URI}}" pattern="(.+)" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="true" />
</rule>
答案 0 :(得分:2)
您可以更改条件中的模式,以使用/
选择跟踪pattern="(.+)/?"
。
您的规则将成为:
<rule name="Redirect for Survey2013" enabled="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{Survey2013:{REQUEST_URI}}" pattern="(.+)/?" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="true" />
</rule>