SEO friendly URL's are not working on a fresh install.
OC: 3.0.3.9
Steps done:
* changed backend settings to use SEO url's
* Renamed .htaccess.text to .htaccess(chmod 664)
Mod rewrite is enabled ( there's another shop running on the same server without problems)
URL: https://lintenwinkel.nl/
Extension: Export/Import Tool (V4.17) for OpenCart 3.x
Anybody has a solution?
OC: 3.0.3.9
Steps done:
* changed backend settings to use SEO url's
* Renamed .htaccess.text to .htaccess(chmod 664)
Mod rewrite is enabled ( there's another shop running on the same server without problems)
URL: https://lintenwinkel.nl/
Extension: Export/Import Tool (V4.17) for OpenCart 3.x
Anybody has a solution?
Have you actually enabled SEO Urls in the System > Settings > edit > tab Server > Use SEO URLs ?
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
644 Indeed. type mistake.
I can access the friendly URL direct: https://lintenwinkel.nl/satijn-lint-6-mm
But in the navigation it doesn't work
I can access the friendly URL direct: https://lintenwinkel.nl/satijn-lint-6-mm
But in the navigation it doesn't work
Check the value of config_seo_url in your oc_setting table in your database and also check if there are any duplicates.
Check your catalog/controller/startup/seo_url.php, to make sure its rewrite function hasn't been modified or tampered with.
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
The file looks (644) untouched
Code: Select all
<?php
class ControllerStartupSeoUrl extends Controller {
public function index(): void {
// 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_']);
// remove any empty arrays from trailing
if (oc_strlen(end($parts)) == 0) {
array_pop($parts);
}
foreach ($parts as $part) {
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "seo_url` WHERE `keyword` = '" . $this->db->escape($part) . "' AND `store_id` = '" . (int)$this->config->get('config_store_id') . "'");
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];
}
if ($query->row['query'] && $url[0] != 'information_id' && $url[0] != 'manufacturer_id' && $url[0] != 'category_id' && $url[0] != 'product_id') {
$this->request->get['route'] = $query->row['query'];
}
} else {
$this->request->get['route'] = 'error/not_found';
break;
}
}
if (!isset($this->request->get['route'])) {
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';
}
}
}
}
public function rewrite($link) {
$url = '';
$data = [];
$url_info = parse_url(str_replace('&', '&', $link));
parse_str($url_info['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 . "seo_url` WHERE `query` = '" . $this->db->escape($key . '=' . (int)$value) . "' AND `store_id` = '" . (int)$this->config->get('config_store_id') . "' AND `language_id` = '" . (int)$this->config->get('config_language_id') . "'");
if ($query->num_rows && $query->row['keyword']) {
$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 . "seo_url` WHERE `query` = 'category_id=" . (int)$category . "' AND `store_id` = '" . (int)$this->config->get('config_store_id') . "' AND `language_id` = '" . (int)$this->config->get('config_language_id') . "'");
if ($query->num_rows && $query->row['keyword']) {
$url .= '/' . $query->row['keyword'];
} else {
$url = '';
break;
}
}
unset($data[$key]);
}
}
}
if ($url) {
unset($data['route']);
$query = '';
if ($data) {
foreach ($data as $key => $value) {
$query .= '&' . rawurlencode((string)$key) . '=' . rawurlencode((is_array($value) ? http_build_query($value) : (string)$value));
}
if ($query) {
$query = '?' . str_replace('&', '&', trim($query, '&'));
}
}
return $url_info['scheme'] . '://' . $url_info['host'] . (isset($url_info['port']) ? ':' . $url_info['port'] : '') . str_replace('/index.php', '', $url_info['path']) . $url . $query;
} else {
return $link;
}
}
}
I was asking :
"Are you sure your (default) language is set correctly?"
because you are not setting a language cookie (just currency and session) and seo url rewrite is language dependent.
Who is online
Users browsing this forum: mauprik and 21 guests