IIS URL Rewrite 2.0,url重写,伪静态

IIS URL Rewrite 2.0出来好像不短时间了,由于也没什么特别需求,也就没对他有研究兴趣。

最近维护另外一个小组开放的程序,发现其使用的就是IIS URL Rewrite 2.0了,而起rewrite规则都写在webconfig中,这就不由得我不管这事了。

曾经为了避免频繁修改webconfig而导致的站点重启,重写了MS提供的IIS URL Rewrite 1.1,讲规则存储在单独的数据文件中,再用个文件缓存依赖来实现实时修改。

而如今2.0的配置还写在webconfig里头,难道又想让我重新2.0的东东。

找到了2.0的相关资料,也找到了其源代码,发现其是支持扩展的,支持规则存于其他数据文件的。

http://www.iis.net/download/URLRewrite  详细信息参考官方文档了。

这里列下2.0的特点:

Features

  • Rules-based URL rewriting engine
  • Rules-based response rewriting engine
  • Support for custom .NET rewrite providers
  • Regular expression pattern matching
  • Wildcard pattern matching
  • Global and distributed rewrite rules
  • Rewriting within the content of specific HTML tags
  • Pre-conditions for outbound rules
  • Access to server variables and HTTP headers
  • Rewriting of server variables and HTTP request headers
  • Rewriting of HTTP response headers
  • Allow list for server variables
  • HtmlEncode function
  • Built-in rule templates
  • Reverse proxy rule template
  • Rule templates for Search Engine Optimization
  • Various rule actions including redirect and request abort
  • Tracking capture groups across rule conditions
  • Logging of rewritten URLs
  • Updated user interface in IIS Manager
  • Integrated user interface for managing rewrite rules and rewrite maps
  • Integrated user interface for importing of Apache mod_rewrite rules
  • Integrated user interface for testing regular expression and wildcard patterns
  • Support for IIS kernel-mode and user-mode output caching
  • Lowercase conversion function
  • Rewrite maps to generate the substitution URL during rewriting
  • Failed Request Tracing support

好处多多,可以了解下,有些方面估计还用得到。

  • Support for custom .NET rewrite providers

    这玩意支持让你方便修改存储位置。

  • 原文地址:https://www.cnblogs.com/buaaboyi/p/1934434.html