regex - IIS7 重写映射正则表达式?

标签 regex iis-7 url-rewriting rewritemap

是否可以在重写映射中使用 reg ex?例如:

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

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

最佳答案

不幸的是,您需要创建规则才能使用正则表达式。

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

关于regex - IIS7 重写映射正则表达式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10104896/

相关文章:

regex - 正则表达式,多个位置上的可选字符,但结果必须至少包含一次

apache - 多个 .htaccess 文件中多个 mod_rewrite 规则的优先级是什么?

JavaScript 正则表达式 : Get HTML Tags

javascript -\B 在正则表达式中没有按预期工作

iis-7 - 通过 MSBuild 在 Web 部署期间设置 ACL

c# - 如何使用 Microsoft.Web.Administration 命名空间在 IIS7 中干净地操作处理程序映射?

iis-7 - PASV后FTP断开

http - IIS 7 URL重写模块: Custom response and Post Data

php - url 中的 htaccess rewriterule 2 参数

.net - 用于选择重复组的正则表达式