问题
Is it possible to use reg ex in a rewrite map? For example:
<rewriteMap name="Redirects">
<add key="/blah/(.*)" value="/blah/{R:1}" />
</rewriteMap>
Or is there a way to handle this approach? Currently, I have a rule set up to match on everything and then use the rewrite map to map to new urls. I would like to capture everything under a directory e.g. resource files (blah)... without having to manually to do this for them all.
回答1:
Unfortunately not, you'll need to create a rule to use regular expressions.
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
来源:https://stackoverflow.com/questions/10104896/iis7-rewrite-map-regex