使用Microsoft URL Rewrite Module for IIS 7.0修改WEB.CONFIG即可实现*.HTML伪静态 无需修改应用程序映射
在IIS5和IIS6时代,我们使用URL REWRITING可实现URL重写,使得WEB程序实现伪静态,但默认情况下只能实现.ASPX的伪静态,如果要实现伪静态*.HTML的页面,需要将ISAPI里面的*.HTML应用程序映射改为.NET的ISAPI。但在IIS 7时代,这一切已经变得非常简单了,您在WEB.CONFIG中就可以管理这一切了。在服务器上安装好Microsoft URL Rewrite Module,具体下载地址如下:
Microsoft URL Rewrite Module for IIS 7.0 (x86)
下载地址:http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1691
Microsoft URL Rewrite Module for IIS 7.0 (x64)
下载地址:http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1692
安装好之后如图:
http://www.cnblogs.com/images/cnblogs_com/lixyvip/url_image001.jpg
http://www.cnblogs.com/images/cnblogs_com/lixyvip/url_image002.png
可以直接在IIS 7里面进行添加重写规则,也可以直接在WEB.CONFIG中设置:
<div class="cnblogs_code"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rewrite to article.aspx">
<match url="^article/(+).html$" />
<action type="Rewrite" url="article.aspx?newid={R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
页:
[1]