IIS7 Rewrite Map Regex?

我是研究僧i 提交于 2019-11-30 23:40:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!