下载插件URL重写
地址:https://www.microsoft.com/zh-cn/download/details.aspx?id=7435
安装
web.config代码
<system.webServer> <rewrite> <rules> <rule name="已导入的规则 1" stopProcessing="true"> <match url="^test.html$" ignoreCase="false" /> <action type="Rewrite" url="/test.aspx" /> </rule> <rule name="Imported Rule 8" stopProcessing="true"> <match url="^Default.html$" ignoreCase="false" /> <action type="Rewrite" url="/Default.aspx" /> </rule> <rule name="Default2"> <match url="^Default2-([0-9]+)-([0-9]+).html$" /> <action type="Rewrite" url="Default2.aspx?cid={R:1}&page={R:2}" /> </rule> <!--输入错误的页面参数是跳转404 一定要放在最下面 否则优先匹配--> <rule name="404" stopProcessing="true"> <match url="^(.*).html$" ignoreCase="false" /> <action type="Rewrite" url="/404.html" /> </rule> </rules> </rewrite> </system.webServer>
IIS 6.0以上 会出现
Url重写 功能 自动匹配