重写条件不起作用


Rewrite condition is not working

如何在opencart中重写类似的搜索页面的URL

http://IP/opencart/index.php?route=product/search&filter_name=24

但我需要像一样显示它

http://localhost/opencart/product/search/42

或者存在于任何一种用户经常使用的甲酸盐中。我试过像一样

RewriteEngine On
RewriteBase /opencart
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*'.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
RewriteBase /opencart 
RewriteRule ^search$ index.php?route=product/search  [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/search$
RewriteRule ^([^?]*) index.php?route=$1 [L,QSA]

这个怎么样:

RewriteBase /
RewriteRule ^opencart/([^/]*)/([^/]*)/([^/]*)$ /opencart/index.php?route=$1/$2&filter_name=$3 [L]

请注意,route参数中的斜线会使事情变得复杂。