iis下ISAPI_Rewrite配置及 iis rewrite 规则书写

1. 下载 ISAPI_Rewrite 我这里的 1.3 2. 进入iis 信息管理器,点网站-->属性-->ISAPI删除原来的筛选器 3. 点击某个站点-->属性-->添加ISAPI筛选器,我的原则是放到各自己自己的站点下,如在站点里建一个目录ISAPI_Rewrite,然后把 ISAPI_Rewrite.dll 和 httpd.ini 放这里 4. 配置好重启一下 iis ,接下来就是调试 httpd.ini 了, 5. 调试httpd.ini 不需要重启 iis 和站点 6. httpd.ini 编写规则需要注意的是: .?这些要转义 /./? 例子: [ISAPI_Rewrite] # 3600 = 1 hour CacheClockRate 3600 RepeatLimit 32 #RewriteCond %{REQUEST_URI} !/(.*)_([0-9]+).*/.html$ RewriteRule /auction_(.*)_([0-9]+).*/.html$ /productdetails/.php/?aid=$2 [L] RewriteRule /all_auctions_([0-9]+)_([0-9]+)_EndedAuction.*/.html$ /allauctions/.php/?pgno2=$2&id=$1&hashtag=EndedAuction RewriteRule /all_auctions_([0-9]+)_([0-9]+)_FutureAuction.*/.html$ /allauctions/.php/?pgno3=$2&id=$1&hashtag=FutureAuction RewriteRule /all_auctions_([0-9]+)_([0-9]+).*/.html$ /allauctions/.php/?pgno=$2&id=$1 RewriteRule /all_auctions_([0-9]+)_(.*).*/.html$ /allauctions/.php/?pgno=$1&st=$2 RewriteRule /all_auctions_([0-9]+).*/.html$ /allauctions/.php/?id=$1 RewriteRule /all_auctions_([0-9]+)_([0-9]+)_VIP.*/.html$ /allauctions/.php/?id=$1&vid=$2 RewriteRule /all_ended_auctions_([0-9]+)_([0-9]+)_([a-zA-Z]).*/.html$ /allauctions/.php/?aid=$1&pgno2=$2&hashtag=$3 RewriteRule /all_future_auctions_([0-9]+)_([0-9]+)_([a-zA-Z]).*/.html$ /allauctions/.php/?aid=$1&pgno3=$2&hashtag=$3 RewriteRule /all_([a-z]+)_auctions_([0-9]+)_([a-zA-Z]).*/.html$ /allauctions/.php/?aid=$2&hashtag=$3 RewriteRule /all_([a-z]+)_auctions_([0-9]+)_([0-9]+).*/.html$ /allauctions/.php/?aid=$2&pgno=$3 RewriteRule /all_([a-z]+)_auctions_([0-9]+).*/.html$ /allauctions/.php/?aid=$2 RewriteRule /bid_history_([0-9]+)_N.*/.html$ /bid_history/.php/?pgNo=$1 RewriteRule /([a-zA-Z_]+)_([0-9]+).*/.html$ /$1/.php/?pgno=$2 RewriteRule /(.*)/.html$ /$1/.php [I] 7. 如果IIS网站 已经配置了ISAPI筛选器, 其实也可以用. 那么每一个站点的 httpd.ini 就是放在站点的根目录下面, 如果不能显示正常,则是httpd.ini 规则的写法问题 补充: 由于我是先删了网站的 ISAPI筛选器,配置了独立站点的 ISAPI筛选器,现在想恢复网站(所有站点都有效)的ISAPI筛选器, 添加之后发现加载不成功, 其实这个需要重启 IIS. 如果站点也配了ISAPI筛选器那么,站点的起作用, httpd.ini 是同站点配的ISAPI筛选器 的ISAPI_Rewrite.dll 同一个目录下的 httpd.ini 生效,而不是站点根目录的 httpd.ini 起作用. 注意:最后可能需要重启IIS服务器,检查一下ISAPI过滤器中Rewrite是否已经载入——绿色的向上箭头。另外,如果是NTFS文件系统,ISAPI_Rewrite的安装目录需要添加网站用户或everyone的写权
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值