0

当前网址:

/shop/?display=category&id=cloths

改写为:

/shop/cloths

使用以下规则:

RewriteRule ^shop/([^/\.]+)$ /shop/index.php?display=category&id=$1 [L]

问题是我需要能够向 url 添加更多的 $_GET 变量,例如:

/shop/cloths?page=2

我无法弄清楚这需要什么规则。我也不想限制额外变量的名称,所以我可以:

/shop/cloths?page=
/shop/cloths?filter=
/shop/cloths?page=&filter=
4

1 回答 1

0

只需添加QSA标志:

RewriteRule ^shop/([^/\.]+)$ /shop/index.php?display=category&id=$1 [QSA,L]

http://httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa

于 2012-04-19T11:15:29.933 回答