+ -
当前位置:首页 → 问答吧 → 高分求一个ISAPI_Rewrite 正则

高分求一个ISAPI_Rewrite 正则

时间:2011-02-08

来源:互联网

各位大侠好,我是用ISAPI_Rewrite3.1进行URL重写的,遇到个正则问题,望指教.

现在想将:
http://www.baidu.com/apple
http://www.baidu.com/apple/
http://www.baidu.com/apple/AbcDeC_
http://www.baidu.com/apple/AbcDeC_/

这四种URL映射到
http://www.baidu.com/article.asp?path=apple&name=AbcDeC_

该如何写正则呢?正则还需要去掉.css,.js,.jpg,.html等地址.

例如:http://www.baidu.com/css/index.js这样的URL将不能匹配.

作者: tombow   发布时间: 2011-02-08

试试这个:httpd.ini
Assembly code

[ISAPI_Rewrite]

# 3600 = 1 hour
CacheClockRate 3600

RepeatLimit 32



RewriteRule ^/([^\/]+)/?$ /article\.asp?path=$1&name= [L]
RewriteRule ^/([^\/]+)/([a-zA-Z]+_)/?$ /article\.asp?path=$1&name=$2 [L]


作者: default7   发布时间: 2011-02-14