开发者

RewriteRule using $10, $11, $12, and so on

It seems that I cannot use a regex group when using mod rewrite, e.g.

results/(.*?)(/(.*?))(/(.*?))(/(.*?))(/(.*?))(/(.*?))(/(.*?))(/(.*?))(/(.*?))(/(.*?))

That would do something like this:

results.php?a=$1&b=$3&c=$5&d=$7&e=$9&f=$11&g=$13&h=$15&i=$17&j=$19

For those numbers that have a 1 in it would append the $1 group and a number, e.g.

$1 is a+typical+get+quer开发者_JS百科y

and $19 is the page number, it would return a+typical+get+query9 as you can see the number is appended at the end.

print_r($_GET):

Array
(
    [a] => a typical get query
    [b] => some other field for the query
    [c] => 1
    [d] => 1
    [e] => 1
    [f] => a typical get query1
    [g] => a typical get query3
    [h] => a typical get query5
    [i] => a typical get query7
    [j] => a typical get query9
)

Why is it doing this?


There is a limit of 9 back references ($1, $2,... $9) in mod_rewrite.

The $10 $11 etc back references are being interpreted as just $1.

See this post for some tips on conserving the back references (you'll have to write your rule differently): mod_rewrite number of parameters/back-references limitation

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜