开发者

mod_rewrite Problem with rewriting optional query from FORM

    RewriteRule ^([^/.]+)?orderby=([^/.]+)&sort=([^/.]+)$ index.php?category=$1&orderby=$2&sort=$3 [L,NC]
    RewriteRule ^([^/.]+)$ index.php?category=$1 [L,NC]

my html code is like this

    <form method="get" action="">....

If I submit the form the URL is like this: http://site.com/category?orderby=hits&sort=desc (The variables orderby and sort don开发者_JAVA技巧t work) It looks like my first rule is ignored.


use [QSA] flag (means query string append)

RewriteRule ^([^/.]+)$ index.php?category=$1 [L,NC,QSA]

RewriteRule does not use query string to match url

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜