Php 重写条件不起作用
如何在opencart中重写我的搜索页面的URLPhp 重写条件不起作用,php,url,url-rewriting,opencart,Php,Url,Url Rewriting,Opencart,如何在opencart中重写我的搜索页面的URL http://IP/opencart/index.php?route=product/search&filter_name=24 但我需要像这样展示它 http://localhost/opencart/product/search/42 orelse在任何一种格式中都是userfreindly。我试过 RewriteEngine On RewriteBase /opencart RewriteRule ^sitemap.xml$ i
http://IP/opencart/index.php?route=product/search&filter_name=24
但我需要像这样展示它
http://localhost/opencart/product/search/42
orelse在任何一种格式中都是userfreindly。我试过
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参数中的斜杠使事情变得复杂。在webroot中创建一个名为.htaccess的文件,并添加我的答案中的内容。同样在RewriteEngine的基线上方添加一行,上面写着RewriteEngine OnI know@Ruben,但我需要将其放在哪一行……你可以在我的问题上看到我的htaccess文件内容,只需将其直接放在RewriteEngine的行下方。eeh,你需要更具体一些。让我们来看看