The first thing I wanted to do with Opencart was modfy current routing system.
By default look at
myamazingwebsite.com/index.php?route=account/login
I changes this for
myamazingwebsite.com/account/login
Look more friendly
Ok, here we go ..
Go to "system/library/url.php"
Replace link function for
Code: Select all
public function link($route, $args = '', $secure = false) {
$url = ($this->ssl && $secure ? 'https://' : 'http://')
. $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['SCRIPT_NAME']), '/.\\') . '/index.php?route=' . $route;
if ($args) {
if (is_array($args)) {
$url .= '&' . http_build_query($args);
} else {
$url .= str_replace('&', '&', '&' . ltrim($args, '&'));
}
}
foreach ($this->rewrite as $rewrite) {
$url = $rewrite->rewrite($url);
}
// Remove route in URL
if(!strpos($url, '/admin')) {
$url = str_replace('/index.php?route=', '/', $url);
}
return $url;
}
Find
Code: Select all
$this->request->get['route'] = 'error/not_found';
Code: Select all
$this->request->get['route'] = $this->request->get['_route_'];
This changes only create friendly url for your front-office, for back-office (admin area) not.
Dont forget Enabled Seo Url from your admin panel and add .httaccess
Please give me your feedback ..