实现二级域名重写、配置错误问题

参考了一位大侠的办法:http://www.cnblogs.com/dragonstreak_1/archive/2011/03/18/1988212.html

按照上述情况,能实现二级域名重写,但在运行过程中,其他伪静态却失效了。于是乎多加了个urlwrite节点,这样就正常了,为了简洁,省略了不相关的内容

<configSections>
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/> 

<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter"/> 

</configSections> 



<RewriterConfig>
    <Rules>
      <!--MarketShopDetail.aspx?MarketID=$1-->
      <RewriterRule>
        <LookFor>http://([A-Za-z0-9-]*[^www]).xxxxx.com/</LookFor>
        <SendTo>~/MarketDetail.aspx?UName=$1</SendTo>
      </RewriterRule>
    </Rules>
  </RewriterConfig>


  <rewriter>
    <!--OK start-->
    <rewrite url="~/company/news/([A-Za-z0-9-]*).html$" to="~/DesignerNewsDetail.aspx?NewsID=$1" processing="stop"/>
    <rewrite url="~/search.html" to="~/Search.aspx" processing="stop"/>
    <rewrite url="~/websearch.html" to="~/MyWebSearch.aspx" processing="stop"/>
    <rewrite url="~/build/company/product/([A-Za-z0-9-]*).html$" to="~/BuildCompanyProductDetail.aspx?ProductID=$1" processing="stop"/>
    <rewrite url="~/build/picbuild/([A-Za-z0-9-]*).html$" to="~/BuildSeePicSayBuild.aspx?PageIndex=$1" processing="stop"/>
    <rewrite url="~/market/news/list.html" to="~/MarketNewsList.aspx" processing="stop"/>
    <rewrite url="~/register.html" to="~/Register.aspx" processing="stop"/>
  </rewriter>
 <httpModules>
       <add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter"/>
       <add type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" name="UrlRewriter"/>
 </httpModules>

还有一个值得注意的地方是避免重复添加映射:应用程序扩展通配符应用程序映射如图,不要同时添加,我这里实现二级域名重写,仅在下面添加通配符应用即可



评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值