是否可以在重写映射中使用 reg ex?例如:
<rewriteMap name="Redirects">
<add key="/blah/(.*)" value="/blah/{R:1}" />
</rewriteMap>
或者有没有办法处理这种方法?目前,我设置了一个规则来匹配所有内容,然后使用重写映射映射到新的 url。我想捕获目录下的所有内容,例如资源文件(等等)...而不必手动为它们全部执行此操作。
最佳答案
不幸的是,您需要创建规则才能使用正则表达式。
Notice that there is no obvious common pattern in the keys and their relation to values. This means that it is not possible to use regular expressions or wildcards to define URL transformation logic. http://www.iis.net/learn/extensions/url-rewrite-module/using-rewrite-maps-in-url-rewrite-module
关于regex - IIS7 重写映射正则表达式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10104896/