我正在删除OpenCart URL上的index.php?route=common/home
。我用的是最新的版本。我试过了:
$link = str_replace('index.php?route=', '', $link);
但是它把我引导到了
"对象未找到......错误404"。
我认为你想要的是一个sef url为每个默认的开放功能正确吗?如果是这样,你可以使用一个插件,从anung,在官方开放的板。这个想法是一个巨大的if/elseif,所有默认路由都在"catalog/controller/common/seo_url.php",然后检查请求路径,像这样:
} elseif ($this->request->get['_route_'] == 'contato') {
$this->request->get['route'] = 'information/contact';
} elseif ($this->request->get['_route_'] == 'account') {
$this->request->get['route'] = 'account/account';
} elseif (isset($this->request->get['path'])) {
然后,在检查if ($key == 'path')之前,检查你的路由:
} elseif (isset($data['route']) && $data['route'] == 'information/contact') {
$url .= '/contato';
} elseif (isset($data['route']) && $data['route'] == 'account/account') {
$url .= '/account';
} elseif ($key == 'path') {
如果你想要插件,你可以在官方openart板上搜索。
您面临的问题是.htaccess
文件和那里定义的重写规则。因为该规则正在重写URL(当打开SEO URL时),如
http://store.com/some-category/some-sub-category/some-product
转换成URL,如
http://store.com/index.php?_route_=some-category/some-sub-category/some-product
这意味着SEO url。如果你想创建自己的SEO url,你还需要修改重写规则,例如from
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
到
RewriteRule ^([^?]*) index.php?route=$1 [L,QSA]
(没有测试这个)