Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 663
Sam Gooch Avatar asked Apr 11 '12 11:04

Sam Gooch


1 Answers

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

like image 174
Jay Avatar answered Sep 28 '22 16:09

Jay