简体   繁体   中英

IIS7 Rewrite Map Regex?

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 eg resource files (blah)... without having to manually to do this for them all.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM