伪静态web.config配置步骤

发布时间:2022-04-16 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了伪静态web.config配置步骤脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
复制代码 代码如下:

<?XMl version="1.0" encoding="UTF-8"?>
<configuration>
<!--第一步注册url重写模块放到webconfig的最上部-->
<configSections>
<section name="RewrITerConfig" tyPE="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
</configSections>
<!--第二步添加重写规则-->
<RewriterConfig>
<!--先制定全部重写规则内容-->
<Rules>
<!--制定每个单独页面的规则-->
<RewriterRule>
<!--原始请求地址-->
<SendTo><![CDATA[~/news.aspx?id=$1&amp;pid=$2]]></SendTo>
<!--重写后的地址-->
<LookFor>~/news/(.[0-9]*)/(.[\d]*)\.htML</LookFor>
</RewriterRule>
<RewriterRule>
<!--原始请求地址-->
<SendTo><![CDATA[~/PRoduct.aspx?pid=$1]]></SendTo>
<!--重写后的地址-->
<LookFor>~/product/(.[\d]*)\.zangdalei</LookFor>
</RewriterRule>
</Rules>
</RewriterConfig>
<System.web>
<compilation debug="false" targetFramework="4.0">
<!--第四部url重写止真实的页面也被重写如果网站中真实存在页面,需要添加编译指令不编译真实的html文件-->
<buildProviders>
<add extension=".html" type="System.Web.COMpilation.PageBuildProvider" />
</buildProviders>
</compilation>
<!--第三部url重写 将用户的请求页面交给相应的处理程序,注意请求的后缀名格式-->
<httpHandlers>
<add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
<add verb="*" path="*.zangdalei" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
</httpHandlers>
</system.web>
<system.webServer>
<handlers>
<add name="aspnethtml" path="*.html" verb="GET,POST" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
<add name="aspnetzangdalei" path="*.zangdalei" verb="GET,POST" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
</handlers>
<defaultDocument>
<files>
<clear />
<add value="default.aspx" />
<add value="default.html" />
</files>
</defaultDocument>
</system.webServer>
</configuration>

脚本宝典总结

以上是脚本宝典为你收集整理的伪静态web.config配置步骤全部内容,希望文章能够帮你解决伪静态web.config配置步骤所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。