用两个GET变量重写mods

时间:2014-04-12 23:41:32

标签: php apache .htaccess mod-rewrite

我需要从mydomain.com/search.php?page=1&postcode=xxx更改网址

to:mydomain.com/search/1/xxx

我知道如何将网址从mydomain.com/search.php?page=1更改为mydomain.com/search/1 这可以通过以下方式完成:

RewriteRule    ^search/([0-9]+)/?$    search.php?page=$1    [NC,L]

如何在网址中添加其他GET?

谢谢!

1 个答案:

答案 0 :(得分:3)

这应该有效:

RewriteRule ^search/([0-9]+)/(.*)$ search.php?page=$1&postcode=$2 [NC,L]