URL重写 真正简单有效
一下载安装微软URLRewriter.dll组件到Bin目录
下载地址1:http://www.rickel.cn/uploads/DevTools/MSDNURLRewriting.msi
下载地址2:download.microsoft.com/download/0/4/6/0463611e-a3f9-490d-a08c-877a83b797cf/MSDNURLRewriting.msi
二配置web.config:
<configuration>
<configSections>
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
</configSections>
<RewriterConfig>
<Rules>
<!-- Rules for Main -->
<RewriterRule>
<LookFor>~/test.htm</LookFor>
<SendTo>~/test.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/index.htm</LookFor>
<SendTo>~/default.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/cyjq.htm</LookFor>
<SendTo>~/cyjq.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/cyjy.htm</LookFor>
<SendTo>~/cyjy.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/cyzl.htm</LookFor>
<SendTo>~/cyzl.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/cyzn.htm</LookFor>
<SendTo>~/cyzn.aspx</SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
<system.web>
<httpModules>
<add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter" />
</httpModules>
</system.web>
三,配置IIS
URL重写设置(涉及IIS管理,不能以程序完成,所以需手工设置,可以下载非URL重写,则不用设置)
IIS配置:网站->属性->目录->配置(G)...->映射->应用程序扩展->添加
可执行文件:c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll
扩展名:.html
动作:限制为 GET,HEAD,POST,DEBUG
脚本引擎:选中
确认文件是否存在:不选