使用Url Rewrite,我正在尝试将/ foo_bar / *重定向到/ foo / *。我试过这个:
<rule name="Redirect foo_bar to foo" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_URL}" pattern="^/foo_bar/(.*)" />
</conditions>
<action type="Redirect" url="/foo/{R:1}" />
</rule>
但这只是重定向到/ foo / foo_bar / *。我哪里错了?
答案 0 :(得分:1)
问题在于比赛。我认为你甚至不需要这样的条件。试试以下内容:
<rule name="Redirect foo_bar to foo" stopProcessing="true">
<match url=".*/foo_bar/(.*)" />
<action type="Redirect" url="/foo/{R:1}" />
</rule>