301 redirect OpenCart

时间:2016-06-18 19:57:20

标签: .htaccess redirect

everybody

How does it possible to make 301 redirect from url like

/index.php?_car_=product&filtr[make]=6

To

/catalog/make/audi

I try to use the following code, but it doesn't work

RewriteCond %{THE_REQUEST} ^GET\ /index\.php\?_car_=product&filtr[make]=6 [NC]
RewriteRule ^index.php$ /catalog/make/audi? [R=301,L]

1 个答案:

答案 0 :(得分:1)

你的问题是 [] 是正则表达式特殊字符,你需要通过使用反斜杠从字面上匹配它们来逃避特殊字符,请尝试:

RewriteEngine on
RewriteCond %{THE_REQUEST} ^GET\ /index\.php\?_car_=product&filtr\[make\]=6 [NC]
RewriteRule ^ /catalog/make/audi? [R=301,L]