在url中删除index.php?_route_并将其替换为/

时间:2015-03-20 00:20:44

标签: .htaccess opencart url-rewrite-module

目前我的htaccess上有这个,但是当我访问我网站的内页时,index.php?_route_显示在URL的中间。如何将其替换为/

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/download/(.*) /index.php?route=error/not_found [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]

1 个答案:

答案 0 :(得分:0)

RewriteBase /行下方,添加:

RewriteCond %{THE_REQUEST} \ /index\.php\?_route_=?([^&\ ]*)
RewriteRule ^ /%1? [L,R]