请问以下条件 ISAPI_isapi rewrite win7规则 如何写

ISAPI_Rewrite2.x伪静态规则中怎么实现301和302_百度经验
&&&&&&互联网
分享有回报:
ISAPI_Rewrite2.x伪静态规则中怎么实现301和302
IIS服务器中,可以有多种伪静态规则,我们常见的是ISAPI_Rewrite,他有三个版本,分别是这样的:ISAPI_Rewrite 1.x 下:ISAPI是1.3不能实现301永久性重定向的,只能实现302临时性重定向,有点可惜。&# For ISAPI_Rewrite 1.x&[ISAPI_Rewrite]CacheClockRate 3600RepeatLimit 32&RewriteCond Host: ^weijingtai.org$RewriteRule (.*) http://www.weijingtai.org$1 [R,I]# For ISAPI_Rewrite 2.x&RewriteCond Host: ^weijingtai.org$&RewriteRule (.*) http://www.weijingtai.org$1 [I,RP]&# For ISAPI_Rewrite 3.x&RewriteCond %{HTTP:Host} ^seowuhan.org$&RewriteRule (.*) http://www.weijingtai.org$1 [NC,R=301]&说明:[I,RP]:I表示忽略大小写,RP表示使用301转向,以上都是整个域名重定向。如果你用了ISAPI_Rewrite 2.x,想做302就给上边的例子中[I,RP] 改成[I,R]即可。野狼测试完美支持,用的是&ISAPI_Rewrite 2.7&。
经验内容仅供参考,如果您需解决具体问题(尤其法律、医学等领域),建议您详细咨询相关领域专业人士。
第1期你不知道的iPad技巧1301次分享
第1期win7电脑那些事2205次分享
第2期新人玩转百度经验346次分享
第1期Win8.1实用小技巧1036次分享
第1期小白装大神496次分享
请扫描分享到朋友圈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的写权
转自: /kemy/blog/item/944aa510ffeb0.htmlISAPI_Rewrite规则
ISAPI_Rewrite规则
在news.asp文件中有以下新闻列表:
&a href=&news_view.asp?id=16& target=&_blank&&关税下调:零件进口不增出口&/a&
&a href=&news_view.asp?id=17& target=&_blank&&百度发布第三季财报&/a&
&a href=&news_view.asp?id=18& target=&_blank&&CNET第三季度&/a&
&a href=&news_view.asp?id=19& target=&_blank&&阿里巴巴国际配售达&/a&
用ISAPI_Rewrite规则怎么把这些连接替换成:news.html
&a href=&news_view_16.html& target=&_blank&&关税下调:零件进口不增出口&/a&
&a href=&news_view_17.html& target=&_blank&&百度发布第三季财报&/a&
&a href=&news_view_18.html& target=&_blank&&CNET第三季度&/a&
&a href=&news_view_19.html& target=&_blank&&阿里巴巴国际配售达&/a&
RewriteRule news_view_(.*).html news_view\.asp\?id=$1 [N,I]
&a href=&news_view.asp?id=&%=rs(&id&)%&& target=&_blank&&&%=rs(&title&)%&&/a&
你说的好像不行。我试了一下。这段是,是不是要改成:
&a href=&news_view_&%=rs(&id&)%&.html& target=&_blank&&&%=rs(&title&)%&&/a&
这样才行啊??我现在是不想动源文件,网站是做好的,现在要做成的,如果改源文件的话太麻烦了。
RewriteRule /news.html /news.aspRewriteRule /news_view_([0-9,a-z]*).html /news_view.asp\?id=$1RewriteRule /news_([0-9,a-z]*).html /news.asp?page=$1
这些是我写好的。用是都可以用,在地址栏里输入都是好用的,不过改不了网页中的连接,如果改的话还必须动源文件。
我记得可以改网页中的列接地址,不过我忘了怎么写了。
首先要明个道理 ISAPI_Rewrite 是把 asp 文件 模拟成html
而你现在需要的是把asp文件里的连接改成html ISAPI_Rewrite 不会去分析和变动你的ASP代码
所以你必须改 你以后可以用个函数来处理连接
比如&a href=&&%=htmlasp(news_view,id)%&&
htmlasp(urlname,urlid) 里
if isRewrite then
url=urlname&&_&&urlid&&.html&
url= urlname&&.asp?id=&&urlid
&%function htmlasp(urlname,urlid)
if isRewrite then
url=urlname&&_&&urlid&&.html&
url= urlname&&.asp?id=&&urlid
end ifend function%&&a href=&&%=htmlasp(&news_view&,&1&)%&&&测试一&/a&
这个样子吗???
函数没写完整。
&%function htmlasp(urlname,urlid)if isRewrite thenurl=urlname&&_&&urlid&&.html&elseurl= urlname&&.asp?id=&&urlidend ifhtmlasp=urlend function%&
另外你要有个 isRewrite 等于真或者假哦~
我改成这样的了。后台可以控制的生成:
&%dim isRewriteisRewrite = &html&function htmlasp(urlname,urlid)Dim url
if isRewrite = &html& then
url=urlname&&_&&urlid&&.html&
url= urlname&&.asp?id=&&urlid
htmlasp = urlend function%&&a href=&&%=htmlasp(&news_view&,&1&)%&&&测试一&/a&
太感谢你了!!!
的感言:呵呵,非常感谢 !!!!
等待您来回答
网页制作领域专家阅读:3323回复:11
求ISAPI Rewrite一规则 域名自动加www
发布于: 23:25
如题 比如地址栏 输入 x.com &重写为
、x.com/bbs &重写优化一下域名 哈呵!小弟先谢过!
2星了 只能评3分!呵呵!#¥;$
贡献1456点
发布于: 23:26
直接转发!
铜币1772两
发布于: 23:29
用户被禁言,该主题自动屏蔽!
<span class="lou J_floor_copy" title="复制此楼地址"
data-hash="read_楼#
发布于: 23:35
直接转发不了呀,注:为了您的URL转发的地址生效,您必须将您所填写的主机名在“DNS解析管理”增加别名至m.com. !错误:CNAME解析记录不能与域名相同, 不能是泛解析
2星了 只能评3分!呵呵!#¥;$
<span class="lou J_floor_copy" title="复制此楼地址"
data-hash="read_楼#
发布于: 23:45
还有 URL 转发 能 x.com/bbs &---& & 转发吗?! 汗!
2星了 只能评3分!呵呵!#¥;$
<span class="lou J_floor_copy" title="复制此楼地址"
data-hash="read_楼#
发布于: 09:42
2星了 只能评3分!呵呵!#¥;$
PW官方侠客
铜币5531两
威望134295点
贡献142759点
<span class="lou J_floor_copy" title="复制此楼地址"
data-hash="read_楼#
发布于: 09:45
不是经常上线, 大家学会寻找解决方法.
一个公众微信:BrandService
只做有意义的事!
<span class="lou J_floor_copy" title="复制此楼地址"
data-hash="read_楼#
发布于: 09:54
谢谢 骨头兄,我看看、试试先!
2星了 只能评3分!呵呵!#¥;$
<span class="lou J_floor_copy" title="复制此楼地址"
data-hash="read_楼#
发布于: 10:06
骨头兄的方法挺好,但不太适合我的情况,这样bbs可以了 &但我还有cms 呢,骨头兄 写个 iis 的ISAPI Rewrite 模块 的规则吧 & apache下.htaccess中的规则 搬到 httpd.ini 中不能用
2星了 只能评3分!呵呵!#¥;$
<span class="lou J_floor_copy" title="复制此楼地址"
data-hash="read_楼#
发布于: 10:19
<span class="lou J_floor_copy" title="复制此楼地址"
data-hash="read_楼#
发布于: 13:53
& &自己搞定了!!
2星了 只能评3分!呵呵!#¥;$
<span class="lou J_floor_copy" title="复制此楼地址"
data-hash="read_楼#
发布于: 00:01
引用第10楼lblzy于 13:53发表的 &: & &自己搞定了!!我也需要阿,为啥不分享一下?
|||||||||||||||
Powered by
& 2003- 版权所有

我要回帖

更多关于 isapi rewrite3 的文章

 

随机推荐