我想用[C]但好像没用!
参数超过9个
RewriteRule ^list-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html$ list.php?a=$1&i=$2&b=$3&c=$4&d=$5e$6&f=$7&g=$8&h=$9&i=$10&j=$11 请问怎么写才起作用

解决方案 »

  1.   

    顶................难道CSDN越来越没人了
      

  2.   

    没时间想了,给你一段文章,自已看吧
    ===========================
    apache的rewrite正则表达式有限制,正则的模块数最多不能超过9个,假如模块数超过9个,该怎么办呢?以下是我的解决方法,例如我要把:
       /search!result.action?param1=1&param2=2&param3=3&param4=4&param5=5&param6=6&param7=7&param8=8&param9=9&param10=10&param11=11&keywords=xx
      rewrite一下,做个反向代理,用户可以通过以下链接访问:
      /search/1-2-3-4-5-6-7-8-9-10-11.html?keywords=xx
      很显然,常规的rewrite是无法解决的,我们必须分两步走,把url分解。
      1、RewriteRule ^/search/(\d+)-(\d+)-(\d+)-(\d+)-(\d+)-(\d+)-(\d+)-(.*)\.html(.*) /search/$8.htmlparam1=$1&param2=$2&param3=$3&param4=$4&param5=$5&param6=$6&param7=$7$9 [C]
      这里先把param1到param7 处理,param8到param11用$8传递到下一条规则处理
      2、RewriteRule ^/search/(\d+)-(\d+)-(\d+)-(\d+)\.html(.*) /search!result.action?$5&param8=$1&param9=$2&param10=$3&param11=$4 [QSA,P,L]
      这里是对规则1后半部分的rewrite,$5表示了规则1中/search/$8.html后面的字符串,$1到$4处理了param8到param11的参数,最后使用QSA追加参数的方式处理keywors参数。
      注:
      C|chain:表示出了该行重写规则外还要有其他的重写规则,,如果第一条规则条匹配的话进行下一项条件匹配,如果第一条或者中间一条匹配不成功,在其后的都会被跳过。
      L|last:表示当前规则是最后一条规则,停止分析以后规则的重写。
      P|proxy:需要模块 mod_proxy 支持, 类似一个分发器网关的作用,比如网站的所有图片想用单独的一台服务器来运行,那么先前的代码里的图片请求的时候,直接定向到图片服务器去,使用[P]标志,意味着使用了[L]标志,因为使用该标志后马上就重定向到新地址了,后面的重写规则会被忽略掉。
      QSA|qsappend:此标记强制重写引擎在已有的替换串中追加一个请求串,而不是简单的替换,如果需要通过重写规则在请求串中增加信息,就可以使用这个标记。 
      

  3.   

    像京东的这些规则:
    http://www.360buy.com/products/652-828-837-4222-0-0-0-0-0-0-1-1-1.html
    主要就是为了搜索引擎..但我这样写,实现不了,,,,
    #RewriteRule ^list-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-(.*)\.html$   list.php?select=$1&pgs_id=$2&i=$3&pgdi_pgsid=$4&pgdi_pbsid=$5&price=$6&display=$7$8 [C]#RewriteRule    list.php?$8&new_pai=$1&orderbyprice=$2&orderbyview=$3&orderdate=$4&page=$5  [QSA,L] 我知道写法错了,但怎么试也试不了....
      

  4.   

    可将多个参数作为完整一个,匹配传参。php中分离参数
    These are backreferences of the form $N(0 <= N <= 9) which provide access to the grouped parts (parenthesis!) of the pattern from the corresponding RewriteRule directive (the one following the current bunch of RewriteCond directives).