opencart 中的 URL 重写 [英] URL rewrite in opencart
本文介绍了opencart 中的 URL 重写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在 opencart 中重写我的搜索页面的 URL.当前网址是:
How to rewrite the URL for my search page in opencart. Current URL is:
http://IP/opencart/index.php?route=product/search&filter_name=24
但我需要像这样显示:
http://localhost/opencart/product/search/42
或任何用户友好的 URL 格式.我试过这个:
or in any URL format that is an user friendly. I have tried this:
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]
推荐答案
这个怎么样
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
中测试对我来说很好用,请提供您的文件夹名称
Tested works fine for me in RewriteBase
provide your folder name
这篇关于opencart 中的 URL 重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文