使用URLrewrite进行URL伪静态重写
2015-10-25 13:39
274 查看
<?xml version="1.0" encoding="utf-8"?>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkId=169433 -->
<configuration>
<!--使用URLRewriter.dll -->
<configSections>
<section name="RewriterConfig" requirePermission="false" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
</configSections>
<appSettings>
<add key="sqlConn" value="BjYLZtBk358Hbd023T4dVUzers8KD6g5TIG8hZSvYuWZMuFX3LbYEOMXoitRdRK1erqh7waKltA1rre4q5XgQLuQ==" />
</appSettings>
<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor>~/xueyuan/article/([0-9]*)</LookFor>
<SendTo>~/xueyuan/article.aspx?id=$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/xueyuan/C([0-9]*)</LookFor>
<SendTo>~/xueyuan/articles.aspx?cid=$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/xueyuan/P([0-9]*)</LookFor>
<SendTo>~/xueyuan/articles.aspx?pid=$1</SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
<system.web>
<httpHandlers>
<!--使用URLRewriter.dll -->
<add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
<add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
</httpHandlers>
<httpModules>
<add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter" />
</httpModules>
<!--<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />-->
<compilation debug="true" targetFramework="4.0" />
<httpRuntime requestValidationMode="2.0" />
<customErrors mode="Off" />
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<remove name="ScriptModule" />
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated" />
<remove name="ScriptHandlerFactory" />
<remove name="ScriptHandlerFactoryAppServices" />
<remove name="ScriptResource" />
<add name="HTML" 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="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</handlers>
</system.webServer>
</configuration>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkId=169433 -->
<configuration>
<!--使用URLRewriter.dll -->
<configSections>
<section name="RewriterConfig" requirePermission="false" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
</configSections>
<appSettings>
<add key="sqlConn" value="BjYLZtBk358Hbd023T4dVUzers8KD6g5TIG8hZSvYuWZMuFX3LbYEOMXoitRdRK1erqh7waKltA1rre4q5XgQLuQ==" />
</appSettings>
<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor>~/xueyuan/article/([0-9]*)</LookFor>
<SendTo>~/xueyuan/article.aspx?id=$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/xueyuan/C([0-9]*)</LookFor>
<SendTo>~/xueyuan/articles.aspx?cid=$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/xueyuan/P([0-9]*)</LookFor>
<SendTo>~/xueyuan/articles.aspx?pid=$1</SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
<system.web>
<httpHandlers>
<!--使用URLRewriter.dll -->
<add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
<add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
</httpHandlers>
<httpModules>
<add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter" />
</httpModules>
<!--<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />-->
<compilation debug="true" targetFramework="4.0" />
<httpRuntime requestValidationMode="2.0" />
<customErrors mode="Off" />
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<remove name="ScriptModule" />
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated" />
<remove name="ScriptHandlerFactory" />
<remove name="ScriptHandlerFactoryAppServices" />
<remove name="ScriptResource" />
<add name="HTML" 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="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</handlers>
</system.webServer>
</configuration>
相关文章推荐
- 伪静态技术介绍与优缺点分析(较完整篇)
- 真伪静态区别方法分析
- 比较详细的Asp伪静态化方法及Asp静态化探讨
- 借助javascript代码判断网页是静态还是伪静态
- ISAPI-REWRITE伪静态规则写法以及说明
- PHP 伪静态技术原理以及突破原理实现介绍
- apache中通过mod_rewrite实现伪静态页面的方法
- DEDECMS TAG伪静态 IIS_rewrite配置方法附rewrite下载
- asp.net下通过泛解析和伪静态实现二级域名的实现方法
- asp.net伪静态配置备忘
- 关于页面优化和伪静态
- apache中伪静态配置和使用(Apache虚拟主机下Discuz伪静态)
- 通过伪静态解决中文乱码问题
- 伪静态与真静态哪种合适更适合你的站第1/2页
- PHP伪静态写法附代码
- PHP伪静态页面函数附使用方法
- win2003 iis asp.net伪静态配置图解
- nginx rewrite 伪静态配置参数和使用例子
- 使用纯php代码实现页面伪静态的方法
- IIS安装Apache伪静态插件的具体操作图文