静态地址重写web.config,支持IIS7.0以上版本

 ==== IIS7.0或以上版本参考 web.config ===

<?xml version="1.0" encoding="UTF-8"?>  
<configuration>  
    <system.webServer>  
        <rewrite>  
            <rules>  
                <rule name="product detail">  
                    <match url="^(.*)-?p-([0-9]+).html$" />
                    <action type="Rewrite" url="product.asp?id={R:2}" />  
                </rule>
  <rule name="product detail2">  
                    <match url="^(.*)-?p-([0-9]+).html$" />                                           //404,这里不加根路径
                    <action type="Rewrite" url="wholesale/product.asp?id={R:2}" />   //若404,试加上根路径  /wholesale/...
                </rule>
            </rules>  
        </rewrite>  
    </system.webServer>  
</configuration> 

 

.NET RewriteUrl控件, 重写规则示例:

<rewriter>
   <rewrite url="(.*)/default.html$" to="$1/default.aspx" processing="stop" />
   <rewrite url="(.*)/searchdo-page-([0-9]+)-t-([\d]+)-k-(.+).html$" to="$1/searchdo.aspx?page=$2&amp;t=$3&amp;k=$4" processing="stop" />
   <rewrite url="(.*)/searchdo-page-([0-9]+)-classid-(\d+)-t-([\d]+)-k-(.+).html$" to="$1/searchdo.aspx?page=$2&amp;classid=$3&amp;t=$4&amp;k=$5" processing="stop" />
   <rewrite url="(.*)/searchdo-t-([\d]+)-k-(.+).html$" to="$1/searchdo.aspx?t=$2&amp;k=$3" processing="stop" />
   <rewrite url="(.*)/searchdo.html$" to="$1/searchdo.aspx" processing="stop" />

</rewrite>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值