Rewrite condition is not working

匿名 (未验证) 提交于 2019-12-03 08:30:34

问题:

How to rewrite the URL for my search page in opencart that is like

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

But I need to display it like

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

orelse in any formate that is an userfreindly.I have tried like

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]

回答1:

How about this:

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

Please note that the slash in the route parameter complicates things.



转载请标明出处:Rewrite condition is not working
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!