Apache重写规则没有get参数


apache rewrite rule has no get parameters

我有这个。htaccess文件:

RewriteEngine On
    RewriteBase /
    RewriteRule ^product/(.*?)/.*'.html$ /product.php?sku=$1 [L,QSA]

所以当我打开一个页面->

/product/something/doesntMatterHere.html

它将被重定向到-->

    /product.php?sku=something

但是当我检查我的代码时,我没有得到任何get变量。

但是,当我进入url ->

/product/something/doesntMatterHere.html?var1=something2

在GET变量中我看到->

$_GET['var1'] = 'something2'

所以重写工作,但得到消失,有什么想法吗?

试试下面的

代替

RewriteRule ^product/(.*?)/.*'.html$ /product.php?sku=$1 [L,QSA]

RewriteRule ^product/(.*)/(.*)'.html$ product.php?sku=$1 [L,QSA]