<?xml version="1.0"?> <!--先引用URLRewriter.dll,放置于Bin目录--> <configuration> <configSections> <!--配置重写规则节点--> <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/> </configSections> <connectionStrings> <add name="TestConnectionString" connectionString="Data Source=.;Initial Catalog=Test;Integrated Security=True" providerName="System.Data.SqlClient"/> </connectionStrings> <!--重写规则--> <RewriterConfig> <Rules> <RewriterRule> <LookFor>~/product/([0-9]*)\.html</LookFor> <!--http://www.xxx.com/product/8001.html--> <SendTo>~/product.aspx?pid=$1</SendTo> <!--http://www.xxx.com/product.aspx?pid=8001--> </RewriterRule> <RewriterRule> <LookFor>~/product/([0-9]*)-([0-9]*)\.html</LookFor> <!--http://www.xxx.com/product/101-8001.html--> <SendTo>~/product.aspx?sid=$1&pid=$2</SendTo> <!--http://www.xxx.com/product.aspx?sid=101&pid=8001--> </RewriterRule> <RewriterRule> <LookFor>~/product/([0-9]*)/([0-9]*)\.html</LookFor> <!--http://www.xxx.com/product/101/8001.html--> <SendTo>~/product.aspx?sid=$1&pid=$2</SendTo> <!--http://www.xxx.com/product.aspx?sid=101&pid=8001--> </RewriterRule> </Rules> </RewriterConfig> <system.web> <httpHandlers> <add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter"/> <add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter"/> </httpHandlers> <compilation debug="true" targetFramework="4.0"/> </system.web> </configuration>
使用微软URLRewriter.dll的url实现任意后缀名重写,布布扣,bubuko.com
使用微软URLRewriter.dll的url实现任意后缀名重写
原文地址:http://blog.csdn.net/smartsmile2012/article/details/26607415