isapi_rewrite 规则问题 高手进!!

来源:百度知道 编辑:UC知道 时间:2024/06/16 05:07:04
例如我把

http://www.baidu.com/test.asp?id=8 伪成

http://www.baidu.com/test/8.html

规则如下

RewriteRule ^(.*)/test/([0-9]*)\.html$ $1/test\.asp\?id=$2

虽然这样可以用http://www.baidu.com/test/8.html访问,但是出现了个问题.这个网页里面的图片都不显示了. 我使用的是相对路径image/xxx.jpg换成http://www.baidu.com/test/8.html

访问时,相当于图片的路径变为test/image/xxx.jpg.所以都不显示了. 高手帮个忙啊 应该怎么解决!!

RewriteRule /products_([0-9]*).html /products/products_detail.asp\?pr_id=$1 [I]

([0-9]*) 正则表达数字 $1 第一个正则
[i] 参数是忽略大小写
?前面要加上\ 因为?是正规的符号,不能冲突

RewriteRule /products_([0-9]*)_([0-9]*).html /products/products_detail.asp\?pr_id=$1&pro_class=$2 [I]