当前网址:
/shop/?display=category&id=cloths
重写为:
/shop/cloths
遵守以下规则:
RewriteRule ^shop/([^/\.]+)$ /shop/index.php?display=category&id=$1 [L]
问题是我需要能够将更多的$ _GET变量添加到url中,例如:
/shop/cloths?page=2
我无法弄清楚这需要的规则。我也不想限制额外变量的名称,所以我可以:
/shop/cloths?page=
/shop/cloths?filter=
/shop/cloths?page=&filter=
答案 0 :(得分:0)
只需添加QSA
标志:
RewriteRule ^shop/([^/\.]+)$ /shop/index.php?display=category&id=$1 [QSA,L]
http://httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa