2013-07-10 89 views
1

如何在opencart中爲我的搜索頁面重寫URL。 當前網址是:opencart中的URL重寫

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

但我需要顯示它想:

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

或以任何URL格式是一種用戶友好。 我已經試過這樣:

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

的[URL重寫Opencart的產品搜索引擎優化(可能的複製HTTP ://stuboverflow.com/questions/33278642/url-rewriting-opencart-products-seo) –

回答

1

這樣如何測試一個

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

工作正常,我在RewriteBase提供您的文件夾名稱

+0

對不起@dianuj不工作....我應該改變任何其他文件或管理面板..? – Gautam3164

+0

不,你不必改變任何東西,確保它出現在你的url'product/search/any interger'中,並且檢查你的'RewriteBase' –

+0

看到我編輯的問題....整個.htaccess文件 – Gautam3164