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
好处多多,可以了解下,有些方面估计还用得到。
这玩意支持让你方便修改存储位置。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?