htaccess 重写规则以包含变量

htaccess rewrite rule to include variable

我目前正在使用这个重写规则

RewriteRule ^([\w-]+)/?$ ../new/index.php?product=

位于文件夹 /old 中以制作此

样本.com/old/123

转发到这里

sample.com/new/index.php?product=123


我想在此规则中包含另一个变量以实现此

sample.com/old/123?type=1

转发到这里:

sample.com/new/index.php?product=123&type=1

有人可以帮我算一下吗?

如果将 [QSA] 添加到 RewriteRule 的末尾,它应该将任何其他查询字符串传递给新的 URL:

RewriteRule ^([\w-]+)/?$ ../new/index.php?product= [QSA]