我在网站上有一个帮助部分,现在我想让它重定向到另一个地方。该网站的其余部分应保持不变,这意味着只有帮助部分/内容应该让用户访问另一个网站:
device.domain.net/collection/hgkhghj应该返回到device.domain.net/collection
我可以在hgkhghj的地方找到任何东西。如果我正在编写device.domain.net/collection,那么它应该返回device.domain.net/collection
<rule name="Help Redirect" stopProcessing="true">
<match url="(.*)/collection(.*)" ignoreCase="true" />
<action type="Redirect" url="http:/device.domain.net" appendQueryString="false" redirectType="Permanent" />
</rule>
但目前它正在返回device.domain.net。
我想制作一个规则,如果我输入device.domain.net/gcfhgg,那么它应该返回到device.domain.net。
<rule name="Help Redirect" stopProcessing="true">
<match url="(.*)" ignoreCase="true" />
<action type="Redirect" url="http://device.domain.net" appendQueryString="false" redirectType="Permanent" />
</rule>
但它没有用。
答案 0 :(得分:0)
对于您的第一条规则,您可以使用以下内容(假设它位于同一个域中):
<rule name="Help Redirect" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^collection/(.*)" />
<action type="Redirect" url="collection" appendQueryString="false" redirectType="Permanent" />
</rule>
如果这是在另一个域上,您也需要安装ARR。您的第二条规则更复杂,因为它看起来好像您只是在尝试404页面时才尝试执行重定向。这是我从未使用重写规则做过的事情。这样做是否有理由而不是显示自定义404页面?