Hi,
I have been able to assign SEO URL's to every other page besides the home page! how do i go about doing this?
I have been able to assign SEO URL's to every other page besides the home page! how do i go about doing this?
insert into database table url_alias
INSERT INTO url_alias (query, keyword) VALUES ('common/home', '');
change url_alis if your tables have a prefix
INSERT INTO url_alias (query, keyword) VALUES ('common/home', '');
change url_alis if your tables have a prefix
login to your hosting control panel and go in to phpmyadmin
this shold show your database and all tables in it.
url_alias is a table in your database.
it may be called xxxx_url_alias if you have set a prefix to be applied to all table names.
if so edit my INSERT comand to name the url_alias to match your url_alias table name.
this shold show your database and all tables in it.
url_alias is a table in your database.
it may be called xxxx_url_alias if you have set a prefix to be applied to all table names.
if so edit my INSERT comand to name the url_alias to match your url_alias table name.
hi
i have the same problem
i inserted like this :
Field Value
url_alias_id 1001
query common/home
keyword home
but doesn't work
so im thinking i might be putting the query wrong, ive tried several versions , can somebody give an example ?
i have the same problem
i inserted like this :
Field Value
url_alias_id 1001
query common/home
keyword home
but doesn't work
so im thinking i might be putting the query wrong, ive tried several versions , can somebody give an example ?
Sorry, I forgot to mention that you will also need to edit catalog/controller/common/seo_url.php
Repalce contents with:
Repalce contents with:
Code: Select all
<?php
class ControllerCommonSeoUrl extends Controller {
public function index() {
// Add rewrite to url class
if ($this->config->get('config_seo_url')) {
$this->url->addRewrite($this);
}
// Decode URL
if (isset($this->request->get['_route_'])) {
$parts = explode('/', $this->request->get['_route_']);
$route = "";
foreach ($parts as $part) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($part) . "'");
if ($query->num_rows) {
$url = explode('=', $query->row['query']);
if(count($url) > 1){
if ($url[0] == 'product_id') {
$this->request->get['product_id'] = $url[1];
}
if ($url[0] == 'category_id') {
if (!isset($this->request->get['path'])) {
$this->request->get['path'] = $url[1];
} else {
$this->request->get['path'] .= '_' . $url[1];
}
}
if ($url[0] == 'manufacturer_id') {
$this->request->get['manufacturer_id'] = $url[1];
}
if ($url[0] == 'information_id') {
$this->request->get['information_id'] = $url[1];
}
}else{
$route = $url[0];
}
} else {
$this->request->get['route'] = 'error/not_found';
}
}
if (isset($this->request->get['product_id'])) {
$this->request->get['route'] = 'product/product';
} elseif (isset($this->request->get['path'])) {
$this->request->get['route'] = 'product/category';
} elseif (isset($this->request->get['manufacturer_id'])) {
$this->request->get['route'] = 'product/manufacturer/product';
} elseif (isset($this->request->get['information_id'])) {
$this->request->get['route'] = 'information/information';
}else {
$this->request->get['route'] = $route;
}
if (isset($this->request->get['route'])) {
return $this->forward($this->request->get['route']);
}
}
}
public function rewrite($link) {
if ($this->config->get('config_seo_url')) {
$url_data = parse_url(str_replace('&', '&', $link));
$url = '';
$data = array();
parse_str($url_data['query'], $data);
foreach ($data as $key => $value) {
if (($key == 'product_id') || ($key == 'manufacturer_id') || ($key == 'information_id')) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = '" . $this->db->escape($key . '=' . (int)$value) . "'");
if ($query->num_rows) {
$url .= '/' . $query->row['keyword'];
unset($data[$key]);
}
} elseif ($key == 'path') {
$categories = explode('_', $value);
foreach ($categories as $category) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = 'category_id=" . (int)$category . "'");
if ($query->num_rows) {
$url .= '/' . $query->row['keyword'];
}
}
unset($data[$key]);
}elseif ($key == 'route') {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = '" . $this->db->escape($value) . "'");
if ($query->num_rows) {
$url .= '/' . $query->row['keyword'];
unset($data[$key]);
}
}
}
if ($url) {
unset($data['route']);
$query = '';
if ($data) {
foreach ($data as $key => $value) {
$query .= '&' . $key . '=' . $value;
}
if ($query) {
$query = '?' . trim($query, '&');
}
}
return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url . $query;
} else {
return $link;
}
} else {
return $link;
}
}
}
Who is online
Users browsing this forum: No registered users and 28 guests