在IIS7下,利用Intelligencia.UrlRewriter进行URLReWrite

本文介绍了Windows 7下IIS7里URLReWrite的配置方法,与IIS6配置不同。需先打开IIS7,对要URLReWrite的站点进行配置,将应用程序池的“托管模式”设为集成,最后配置站点下的“Web.config”文件,并给出了具体配置代码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

不同于IIS6的配置,此处稍有不同!
当然大家想知道在II6下的配置,大家可以直接上官方网站,有详细的帮助文档,这里只是简单的说明一下在Windows 7下的IIS7里的配置方法。

首先,还是要打开一下IIS7,对需要URLReWrite的站点进行配置:

 

 

如图,打开应用程序池,找到需要设置的站点,将“托管模式”设置为集成!

最后,就是配置站点下的“Web.config”文件了,具体的配置如下:
view plaincopy to clipboardprint?
<?xml version="1.0" encoding="utf-8"?> 
 
<configuration> 
  <configSections> 
    <!--UrlRewriter--> 
    <section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" /> 
  </configSections> 
 
  <!--UrlRewriter--> 
  <rewriter> 
    <rewrite url="~/ShowNews/(\d+).html$" to="~/ShowNews.aspx?id=$1" processing="stop" /> 
    <rewrite url="~/product/(\d+).html$" to="~/ShowProduct.aspx?id=$1" processing="stop" /> 
  </rewriter> 
 
  <system.web>   
    <!--UrlRewriter Windows 2003 IIS 6 Config Setting--> 
    <!--<httpModules> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<add type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" name="UrlRewriter" /> 
&nbsp;&nbsp;&nbsp;&nbsp;</httpModules>--> 
  </system.web> 
  <system.webServer> 
    <!--UrlRewriter Windows 7 II7 Config Setting--> 
    <modules> 
        <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" preCondition="" /> 
    </modules> 
  </system.webServer> 
      
</configuration> 

文件里已经有注释了,就不多说了,呵呵!就这么简单!

转载于:https://www.cnblogs.com/gooddasenlin/archive/2011/07/06/2099091.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值