IIS7 重写映射正则表达式? [英] IIS7 Rewrite Map Regex?

查看:25
本文介绍了IIS7 重写映射正则表达式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在重写映射中使用正则表达式?例如:

Is it possible to use reg ex in a rewrite map? For example:

<rewriteMap name="Redirects">
   <add key="/blah/(.*)" value="/blah/{R:1}" />
</rewriteMap>

或者有没有办法处理这种方法?目前,我设置了一个规则来匹配所有内容,然后使用重写映射映射到新的 url.我想捕获目录下的所有内容,例如资源文件(废话)...无需手动为它们全部执行此操作.

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.

推荐答案

很遗憾,您需要创建规则才能使用正则表达式.

Unfortunately not, you'll need to create a rule to use regular expressions.

注意键和它们之间没有明显的共同模式值的关系.这意味着不能使用常规表达式或通配符来定义 URL 转换逻辑.http://www.iis.net/learn/extensions/url-rewrite-module/using-rewrite-maps-in-url-rewrite-module

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

这篇关于IIS7 重写映射正则表达式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆