Magento htaccess搜索结果重写


Magento htaccess Search Result Rewrite

我们有一个magento购物车,它使用以下代码检索搜索查询。

http://www.example.com/catalogsearch/result/?q=firstparam + otherparam +东西

我们希望它通过:http://www.example.com/firstparam + otherparam +东西

我们现在的规则似乎都不起作用。

RewriteCond %{QUERY_STRING} q=(.*)
RewriteRule ^/?q/(.*?)/?$ /catalogsearch/result/?q=$1 [R=301,L]

我们尝试了所有这些方法的各种迭代,但都无济于事。

尝试:

RewriteEngine On
RewriteCond %{THE_REQUEST} ' /+catalogsearch/result/'?q=([^&' ]+)
RewriteRule ^ /q/%1? [L,NE,R=301]
RewriteRule ^q/(.*)$ /catalogsearch/result/?q=$1 [L,NE,QSA]