【发布时间】:2016-03-07 19:50:00
【问题描述】:
使用 IIS Url Rewrite,是否可以使用 RewriteMaps 匹配通配符 URL?例如,我有以下重写规则:
<rule name="Disable access except for RewriteMap URLs" enabled="true" stopProcessing="true">
<conditions>
<add input="{Allowed Urls:{URL}}" pattern="1" negate="true" />
</conditions>
<match url="(.*)" />
<action type="Redirect" url="http://{HTTP_HOST}" />
</rule>
它使用以下 RewriteMap:
<rewriteMap name="Allowed Urls">
<add key="/products" value="1" />
<add key="/products/product-1" value="1" />
<add key="/products/product-2" value="1" />
</rewriteMap>
我想修改我的 RewriteMap 以包含一个通配符 URL,这样我就有一个与以下 URL 匹配的 add 元素:
/products/id/1
/products/id/2
/products/id/3
/products/id/4
这样的事情可能吗?
【问题讨论】:
标签: iis url-rewriting url-rewrite-module rewritemap