2013-07-11 45 views
1

如何重写我的搜索页面的URL Opencart的就是喜欢重写条件不工作

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

但我需要在任何甲酸是一种像

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

否则别指望它显示userfreindly.I试图像

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] 

回答

0

如何:

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

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

+0

在您的webroot中创建一个名为.htaccess的文件并添加我的答案中的内容。还在RewriteBase行上面添加一行说RewriteEngine On – Ruben

+0

我知道@Ruben,但在哪一行我需要把....你可以看到我的htaccess文件内容在我的问题 – Gautam3164

+0

帮我请这 – Gautam3164