Lets face it, "index.php?route=" is ugly.
How do we, on the latest version of opencart, remove it from being seen.
I've gone through htaccess, changing the seo_url.php tried modules, both paid and free, and i'm STILL having issues, with the cart page, all the links that are dynamic ie <?php echo contact(); ?> etc.
Does anyone have any solution that really does solve this issue?
How do we, on the latest version of opencart, remove it from being seen.
I've gone through htaccess, changing the seo_url.php tried modules, both paid and free, and i'm STILL having issues, with the cart page, all the links that are dynamic ie <?php echo contact(); ?> etc.
Does anyone have any solution that really does solve this issue?
I have my own script which i use on the sites I make.
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_'])) {
$parts2 = explode('.php', $this->request->get['_route_']);
//$parts = explode('/', $this->request->get['_route_']);
$parts = explode('/', $parts2[0]);
foreach ($parts as $part) {
$part = rtrim($part,'.php');
$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 ($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 {
$this->request->get['route'] = 'error/not_found';
}
}
//print_r($parts2[1]);
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/info';
} elseif (isset($this->request->get['information_id'])) {
$this->request->get['route'] = 'information/information';
} else {
$this->request->get['route'] = $parts2[0];
/*
$parts = explode('/', $this->request->get['_route_']);
$this->request->get['route'] = $parts[0] . '/' . rtrim($parts[1],'.php');
unset($parts[0]);
unset($parts[1]);
$nextpara = '';
foreach( $parts as $key => $value ) {
if( 0 === $key%2) { //Even
$nextpara = $value;
}
else {
$this->request->get[$nextpara] = $value;
}
}*/
}
if (isset($parts2[1])) {
$par = explode('/',$parts2[1]);
unset($par[0]);
$par = array_values($par);
$nextpara = '';
foreach( $par as $key => $value ) {
if( 0 === $key%2) { //Even
$nextpara = $value;
}
else {
$this->request->get[$nextpara] = $value;
}
}
}
if (isset($this->request->get['route'])) {
return $this->forward($this->request->get['route']);
}
} elseif(isset($this->request->get['route'])){
if ($this->request->get['route'] =='product/search') {
$pageURL = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";
if ($_SERVER["SERVER_PORT"] != "80")
{
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
}
else
{
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
$this->redirect($this->rewrite($pageURL));
}
}
}
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 (isset($data['route'])) {
if (($data['route'] == 'product/product' && $key == 'product_id') || (($data['route'] == 'product/manufacturer/info' || $data['route'] == 'product/product') && $key == 'manufacturer_id') || ($data['route'] == 'information/information' && $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]);
}
}
}
if ($url) {
unset($data['route']);
$query = '';
/*
if ($data) {
foreach ($data as $key => $value) {
$query .= '&' . $key . '=' . $value;
}
if ($query) {
$query = '?' . trim($query, '&');
}
}*/
if(count($data)> 0) {
//$url .= '/';
foreach ($data as $key => $value) {
$query .= '/'.$key.'/'.$value;
}
}
return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url . '.php'. $query;
} else {
// echo 'no seo url for '.$link.'<br />';
$url_data = parse_url(str_replace('&', '&', $link));
$url = '/';
$data = array();
parse_str($url_data['query'], $data);
//print_r($data);
$url .= $data['route'] . '.php';
unset($data['route']);
if(count($data)> 0) {
//$url .= '/';
foreach ($data as $key => $value) {
$url .= '/'.$key.'/'.$value;
}
}
//echo $url;
return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url;
//return $link;
}
} else {
return $link;
}
}
}
?>
Hello dear smifis,smifis wrote:I have my own script which i use on the sites I make...
where did you put this code? In Seo-url file?
Do you use it on latest OC 1.5.4.1?
I get this error:
Thank you for clarification,Parse error: syntax error, unexpected T_ELSE in .../vqmod/vqcache/vq2-catalog_controller_common_seo_url.php on line 60.
Vaio
Hey smifis,
i have tried, but so far no luck.
i have changed seo_url.php and emptied vqcache, but get error as shown above and here again:
Parse error: syntax error, unexpected T_ELSE in .../vqmod/vqcache/vq2-catalog_controller_common_seo_url.php on line 60.
Do you use vQmod on your OC?
i have tried, but so far no luck.
i have changed seo_url.php and emptied vqcache, but get error as shown above and here again:
Parse error: syntax error, unexpected T_ELSE in .../vqmod/vqcache/vq2-catalog_controller_common_seo_url.php on line 60.
Do you use vQmod on your OC?
I do but it looks like one of the vqmods is effecting the seo urls.
could you disable all of you vqmods for me and see if it works? if it does then enables each one individually until you find the culprit, tell me what it is, and i'll find a fix or a workaround for you
could you disable all of you vqmods for me and see if it works? if it does then enables each one individually until you find the culprit, tell me what it is, and i'll find a fix or a workaround for you
Hello smifis,
apparentlyGenerate SEO keyword vQmod and seo_url.php are not really compatible.
If you manage to find where/why they are not compatible, this would be really great, since Generator is really good for great SEO address.
Also another question, is it possible to:
1. make Home button go just on domain url: domain.tld/ instead of domain.tld/common/home.php, i believe it is nicer + more useful for SEO
2. hide above category from common links (account, information, common): /account/account.php -> just to show /account.php
3. i experience 'problem' with product categories: /desktops became /desktops.php/path/20
Thank you for your kind help,
V.
apparentlyGenerate SEO keyword vQmod and seo_url.php are not really compatible.
If you manage to find where/why they are not compatible, this would be really great, since Generator is really good for great SEO address.
Also another question, is it possible to:
1. make Home button go just on domain url: domain.tld/ instead of domain.tld/common/home.php, i believe it is nicer + more useful for SEO
2. hide above category from common links (account, information, common): /account/account.php -> just to show /account.php
3. i experience 'problem' with product categories: /desktops became /desktops.php/path/20
Thank you for your kind help,
V.
We have just finished a new 'fixed' version.
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_'])) {
$parts2 = explode('.php', $this->request->get['_route_']);
$parts = explode('/', $parts2[0]);
foreach ($parts as $part) {
$part = rtrim($part,'.php');
$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 ($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 {
$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/info';
} elseif (isset($this->request->get['information_id'])) {
$this->request->get['route'] = 'information/information';
}
if (isset($this->request->get['route'])) {
$this->request->get['route'] = $parts2[0];
}
if (isset($parts2[1])) {
$par = explode('/',$parts2[1]);
unset($par[0]);
$par = array_values($par);
$nextpara = '';
foreach( $par as $key => $value ) {
if( 0 === $key%2) { //Even
$nextpara = $value;
}
else {
$this->request->get[$nextpara] = $value;
}
}
}
if (isset($this->request->get['route'])) {
return $this->forward($this->request->get['route']);
}
} elseif(isset($this->request->get['route'])){
if ($this->request->get['route'] =='product/search') {
$pageURL = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";
if ($_SERVER["SERVER_PORT"] != "80")
{
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
}
else
{
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
$this->redirect($this->rewrite($pageURL));
}
}
}
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 (isset($data['route'])) {
if (($data['route'] == 'product/product' && $key == 'product_id') || (($data['route'] == 'product/manufacturer/info' || $data['route'] == 'product/product') && $key == 'manufacturer_id') || ($data['route'] == 'information/information' && $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]);
}
}
}
if ($url) {
unset($data['route']);
$query = '';
if(count($data)> 0) {
foreach ($data as $key => $value) {
$query .= '/'.$key.'/'.$value;
}
}
return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url . '.php'. $query;
} else {
$url_data = parse_url(str_replace('&', '&', $link));
$url = '/';
$data = array();
parse_str($url_data['query'], $data);
$url .= $data['route'] . '.php';
unset($data['route']);
if(count($data)> 0) {
foreach ($data as $key => $value) {
$url .= '/'.$key.'/'.$value;
}
}
return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url;
}
} else {
return $link;
}
}
}
?>
Were do i put this exactly?.. My sep_url looks like this:
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_']);
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 ($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 {
$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';
}
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 (isset($data['route'])) {
if (($data['route'] == 'product/product' && $key == 'product_id') || (($data['route'] == 'product/manufacturer/product' || $data['route'] == 'product/product') && $key == 'manufacturer_id') || ($data['route'] == 'information/information' && $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]);
}
}
}
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;
}
}
}
?>
Hi guys,
Just to update everyone, I got this working with the generous help from Anung off the forum who provided me with the attached file which goes in vqmod/xml
This fixed all my URL's to be search engine friendly
Thanks again for the help,
Martin
Just to update everyone, I got this working with the generous help from Anung off the forum who provided me with the attached file which goes in vqmod/xml
This fixed all my URL's to be search engine friendly
Thanks again for the help,
Martin
Thanks... seams to work nice...
But on a search. The URL still is: http://seriersant.se/index.php?route=pr ... e=Julalbum
If I want to change the name on for example "/contact" to better fit my language, like "/kontakt"
Were do I do this?
But on a search. The URL still is: http://seriersant.se/index.php?route=pr ... e=Julalbum
If I want to change the name on for example "/contact" to better fit my language, like "/kontakt"
Were do I do this?
Who is online
Users browsing this forum: No registered users and 55 guests