【发布时间】:2021-04-06 15:24:30
【问题描述】:
如何使用 IIS 中的 URL Rewrite 或 web.config 将 2 个相似的 URL 重定向到 2 个不同的 URL?
我的 2 个旧网址是: http://example.com/used-2-3/ http://example.com/used-2-3-2/
我的 2 个新网址是
http://example.com/eq/ex?action=283 http://example.com/eq/ex?action=435
所以我的web.config重写规则是这样的,但它不起作用
<rule name="Used Conveyors Redirect" patternSyntax="ECMAScript" stopProcessing="true">
<match url="(.*)" negate="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_HOST}{REQUEST_URI}" pattern="http://example.com/used-2-3/" />
<add input="{HTTP_HOST}{REQUEST_URI}" pattern="http://www.example.com/used-2-3/" />
</conditions>
<action type="Redirect" url="http://example.com/eq/ex?action=283" redirectType="Permanent" />
</rule>
<rule name="Used Power Vans" patternSyntax="ECMAScript" stopProcessing="true">
<match url="(.*)" negate="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_HOST}{REQUEST_URI}" pattern="http://example.com/used-2-3-2/" />
<add input="{HTTP_HOST}{REQUEST_URI}" pattern="http://www.example.com/used-2-3-2/" />
</conditions>
<action type="Redirect" url="http://example.com/eq/ex?action=435" redirectType="Permanent" />
</rule>
It is not working because both old links redirect to the first new URL.
【问题讨论】:
标签: url redirect url-rewriting