For categories/products etc, to keep the SEO Keyword entry boxes so a user can enter their own, but if these are left blank by the user when adding a product or category, then the name or title is used (after checking it isn't already in use).
This therefore gives the user the option to overwrite (use their own) seo keyword, and at least have a fall-back in case they forget to enter one.
In addition to this and also important is to have Canonical URL Meta Tag in place so site's ranking isn't affected with multiple page name paths going to the same document.
canonical urls are already in place for products and categories.uksitebuilder wrote:
In addition to this and also important is to have Canonical URL Meta Tag in place so site's ranking isn't affected with multiple page name paths going to the same document.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
I kind of agree... Why couldn't they just be http://site.com/laptops-and-notebooks/ or http://site.com/components?Xsecrets wrote: well it's nice that you have the contact pages etc rewritten, and that you can be lazy and not create aliases for your other stuff, but I hate url schemes that use the category and product numbers in them. To be honest I like the default urls better than that.
Why can't each category be given a "slug", and then each product be given a "slug" - so that you could go to (for example):
http://www.yourstore.com/category-slug/product-slug
Is that not possible?
Hi ocpro! Have you already released your Uber SEO extension?ocpro wrote:I've actually been working on an automatic url rewriter for 1.5. You can see the demo here
- SNIPPED -
You can change pretty much any route to a different one, such as information/contact to just contact, so that it reads
http://yoursite.com/contact
Notice that all of the category, product and information URL's are in a standard format, and you don't have to write any of these url's at all. For any of the urls such as route=account/login it will become yoursite.com/account/login unless you edit them
To try out the url customisation, go to
- SNIPPED -
username: demo
password: demo
and go to SYSTEM > UBER SEO
This will be available soon from the extension store (commercial mod). If anyone is interested in purchasing this before hand you can contact me directly
I tried to work it based on the sample SQL queries, but the "=6" got me confused.
Another problem that I noticed is that the old links -- "/index.php?route=" still functions as normal page instead of redirecting to the new SEO friendly urls... Any workaround?
uksitebuilder wrote:Nice one amdev
Here is my SQL for anyone wishing to import via phpMyAdmin
Please let us know if any pages have been missedCode: Select all
INSERT INTO url_alias (query, keyword) VALUES ('common/home', ''); INSERT INTO url_alias (query, keyword) VALUES ('account/wishlist', 'wishlist'); INSERT INTO url_alias (query, keyword) VALUES ('account/account', 'my-account'); INSERT INTO url_alias (query, keyword) VALUES ('checkout/cart', 'shopping-cart'); INSERT INTO url_alias (query, keyword) VALUES ('checkout/checkout', 'checkout'); INSERT INTO url_alias (query, keyword) VALUES ('account/login', 'login'); INSERT INTO url_alias (query, keyword) VALUES ('account/logout', 'logout'); INSERT INTO url_alias (query, keyword) VALUES ('account/order', 'order-history'); INSERT INTO url_alias (query, keyword) VALUES ('account/newsletter', 'newsletter'); INSERT INTO url_alias (query, keyword) VALUES ('product/special', 'specials'); INSERT INTO url_alias (query, keyword) VALUES ('affiliate/account', 'affiliates'); INSERT INTO url_alias (query, keyword) VALUES ('checkout/voucher', 'gift-vouchers'); INSERT INTO url_alias (query, keyword) VALUES ('product/manufacturer', 'brands'); INSERT INTO url_alias (query, keyword) VALUES ('information/contact', 'contact-us'); INSERT INTO url_alias (query, keyword) VALUES ('account/return/insert', 'request-return'); INSERT INTO url_alias (query, keyword) VALUES ('information/sitemap', 'sitemap'); INSERT INTO url_alias (query, keyword) VALUES ('account/forgotten', 'forgot-password'); INSERT INTO url_alias (query, keyword) VALUES ('account/download', 'downloads'); INSERT INTO url_alias (query, keyword) VALUES ('account/return', 'returns'); INSERT INTO url_alias (query, keyword) VALUES ('account/transaction', 'transactions'); INSERT INTO url_alias (query, keyword) VALUES ('account/register', 'create-account'); INSERT INTO url_alias (query, keyword) VALUES ('product/compare', 'compare-products'); INSERT INTO url_alias (query, keyword) VALUES ('product/search', 'search'); INSERT INTO url_alias (query, keyword) VALUES ('account/edit', 'edit-account'); INSERT INTO url_alias (query, keyword) VALUES ('account/password', 'change-password'); INSERT INTO url_alias (query, keyword) VALUES ('account/address', 'address-book'); INSERT INTO url_alias (query, keyword) VALUES ('account/reward', 'reward-points'); INSERT INTO url_alias (query, keyword) VALUES ('affiliate/edit', 'edit-affiliate-account'); INSERT INTO url_alias (query, keyword) VALUES ('affiliate/password', 'change-affiliate-password'); INSERT INTO url_alias (query, keyword) VALUES ('affiliate/payment', 'affiliate-payment-options'); INSERT INTO url_alias (query, keyword) VALUES ('affiliate/tracking', 'affiliate-tracking-code'); INSERT INTO url_alias (query, keyword) VALUES ('affiliate/transaction', 'affiliate-transactions'); INSERT INTO url_alias (query, keyword) VALUES ('affiliate/logout', 'affiliate-logout'); INSERT INTO url_alias (query, keyword) VALUES ('affiliate/forgotten', 'affiliate-forgot-password'); INSERT INTO url_alias (query, keyword) VALUES ('affiliate/register', 'create-affiliate-account'); INSERT INTO url_alias (query, keyword) VALUES ('affiliate/login', 'affiliate-login');
if it has an information_id=X in it then it means that you can edit it from the admin just find the information page with that title and add an SEO keyword.jtothed wrote:Thanks for the SQL queries... You're missing http://www.yousite.com/index.php?route= ... ation_id=6 (Delivery information; you can find this in the sitemap)
I tried to work it based on the sample SQL queries, but the "=6" got me confused.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
there is no solution for that, but it's not a big deal. Simply don't send no seo urls to google.jtothed wrote:Found it; thanks! How about duplicate pages?
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
Not for categories they aren'tXsecrets wrote:canonical urls are already in place for products and categories.uksitebuilder wrote:
In addition to this and also important is to have Canonical URL Meta Tag in place so site's ranking isn't affected with multiple page name paths going to the same document.
Fix:
Open: catalog/controller/product/category.php
Find:
Code: Select all
$this->document->setKeywords($category_info['meta_keyword']);
Code: Select all
$this->document->addLink($this->url->link('product/category', 'path=' . $category_id), 'canonical');
as far as I know there is not any situation where you get duplicate urls on the categories though.uksitebuilder wrote:Not for categories they aren'tXsecrets wrote:canonical urls are already in place for products and categories.uksitebuilder wrote:
In addition to this and also important is to have Canonical URL Meta Tag in place so site's ranking isn't affected with multiple page name paths going to the same document.
Fix:
Open: catalog/controller/product/category.php
Find:Add After:Code: Select all
$this->document->setKeywords($category_info['meta_keyword']);
Code: Select all
$this->document->addLink($this->url->link('product/category', 'path=' . $category_id), 'canonical');
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
Site.com/subcat
Is the same as
Site.com/cat/subcat
Or
Site.com/thirdlevelcat
Is the same as
Site.com/cat/subcat/thirdlevelcat
uksitebuilder wrote:On subcats and third level cats
Site.com/subcat
Is the same as
Site.com/cat/subcat
Or
Site.com/thirdlevelcat
Is the same as
Site.com/cat/subcat/thirdlevelcat
I made a vqmod for it.
I'm tested with 1495 it work.
***Note: because 148-149 don't use url class. So u need to loadamdev wrote:Ok follow these steps.(Backup your systems before)
1.edit this file.copy my code and paste to your file.Code: Select all
\catalog\controller\common\seo_url.php
2.edit this file.Code: Select all
<?php class ControllerCommonSeoUrl extends Controller { public function index() { // 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']); } } } } ?>
Code: Select all
\catalog\model\tool\seo_url.php
3.goto your database Run this mysql command.Code: Select all
<?php class ModelToolSeoUrl extends Model { 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; } } } ?>
'account/account' this is a route.Code: Select all
INSERT INTO url_alias (query, keyword) VALUES ('common/home', ''); INSERT INTO url_alias (query, keyword) VALUES ('account/account', 'my-account'); INSERT INTO url_alias (query, keyword) VALUES ('checkout/cart', 'shopping-cart'); INSERT INTO url_alias (query, keyword) VALUES ('checkout/checkout', 'checkout'); INSERT INTO url_alias (query, keyword) VALUES ('account/login', 'login'); INSERT INTO url_alias (query, keyword) VALUES ('account/logout', 'logout'); INSERT INTO url_alias (query, keyword) VALUES ('account/order', 'order-history'); INSERT INTO url_alias (query, keyword) VALUES ('account/newsletter', 'newsletter'); INSERT INTO url_alias (query, keyword) VALUES ('product/special', 'specials'); INSERT INTO url_alias (query, keyword) VALUES ('product/manufacturer', 'brands'); INSERT INTO url_alias (query, keyword) VALUES ('information/contact', 'contact-us'); INSERT INTO url_alias (query, keyword) VALUES ('information/sitemap', 'sitemap'); INSERT INTO url_alias (query, keyword) VALUES ('account/forgotten', 'forgot-password'); INSERT INTO url_alias (query, keyword) VALUES ('account/download', 'downloads'); INSERT INTO url_alias (query, keyword) VALUES ('account/return', 'returns'); INSERT INTO url_alias (query, keyword) VALUES ('account/transaction', 'transactions'); INSERT INTO url_alias (query, keyword) VALUES ('account/register', 'create-account'); INSERT INTO url_alias (query, keyword) VALUES ('product/search', 'search'); INSERT INTO url_alias (query, keyword) VALUES ('account/edit', 'edit-account'); INSERT INTO url_alias (query, keyword) VALUES ('account/password', 'change-password'); INSERT INTO url_alias (query, keyword) VALUES ('account/address', 'address-book');
'my-account' this is your keyword can edit it if u want.
4.gotoYou will see this codeCode: Select all
\catalog\controller\common\header.php
Then look to bottom code around line 85.Code: Select all
<?php class ControllerCommonHeader extends Controller { protected function index() { //Remember *** load this model before use seo $this->load->model('tool/seo_url');//I'm add this line in index function. if (($this->request->server['REQUEST_METHOD'] == 'POST') && isset($this->request->post['language_code'])) { $this->session->data['language'] = $this->request->post['language_code']; if (isset($this->request->post['redirect']) && strpos($this->request->post['redirect'], HTTP_SERVER) !== false) { $this->redirect($this->request->post['redirect']); } else { //Call $this->model_tool_seo_url->rewrite($link) to rewrite url like this. $this->redirect($this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=common/home')); //Old redirec is $this->redirect(HTTP_SERVER . 'index.php?route=common/home'); } } if (($this->request->server['REQUEST_METHOD'] == 'POST') && isset($this->request->post['currency_code'])) { $this->currency->set($this->request->post['currency_code']); unset($this->session->data['shipping_methods']); unset($this->session->data['shipping_method']); if (isset($this->request->post['redirect']) && strpos($this->request->post['redirect'], HTTP_SERVER) !== false) { $this->redirect($this->request->post['redirect']); } else { //This was solved as well. $this->redirect($this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=common/home')); } }
replace to.Code: Select all
$this->data['home'] = HTTP_SERVER . 'index.php?route=common/home'; $this->data['special'] = HTTP_SERVER . 'index.php?route=product/special'; $this->data['contact'] = HTTP_SERVER . 'index.php?route=information/contact'; $this->data['sitemap'] = HTTP_SERVER . 'index.php?route=information/sitemap'; $this->data['account'] = HTTPS_SERVER . 'index.php?route=account/account'; $this->data['logged'] = $this->customer->isLogged(); $this->data['login'] = HTTPS_SERVER . 'index.php?route=account/login'; $this->data['logout'] = HTTP_SERVER . 'index.php?route=account/logout'; $this->data['cart'] = HTTP_SERVER . 'index.php?route=checkout/cart'; $this->data['checkout'] = HTTPS_SERVER . 'index.php?route=checkout/shipping';
Finished.Code: Select all
$this->data['home'] = $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=common/home'); $this->data['special'] = $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/special'); $this->data['contact'] = $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=information/contact'); $this->data['sitemap'] = $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=information/sitemap'); $this->data['account'] = $this->model_tool_seo_url->rewrite(HTTPS_SERVER . 'index.php?route=account/account'); $this->data['logged'] = $this->customer->isLogged(); $this->data['login'] = $this->model_tool_seo_url->rewrite(HTTPS_SERVER . 'index.php?route=account/login'); $this->data['logout'] = $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=account/logout'); $this->data['cart'] = $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=checkout/cart'); $this->data['checkout'] = $this->model_tool_seo_url->rewrite(HTTPS_SERVER . 'index.php?route=checkout/shipping');
Sory for my bad english.![]()
![]()
![]()
Thanks.
Amdev.
Code: Select all
$this->load->model('tool/seo_url');
ร้านค้าออนไลน์
OpenCart Thailand Support Forum
How to Upgrade oc1.5 to 2.0.1.1
Upgrading OpenCart From v.1.4 or v.1.5 to V.2.2 Step by step
User-agent: *
Disallow: /*?sort
Disallow: /*?route=checkout/
Disallow: /*?route=account/
Disallow: /*?route=product/search
Disallow: /*?page=1
Disallow: /*&create=1
Allow: /
Could we alter this to remove any SEO issues with the re-writen url's?
Such as:
Disallow: /account/
Disallow: /cart/
Okay I have done this mod on version 1.5.1
However slight problem, the image on the contact us page is not coming up (the on that needs to be entered to submit the form).
I think it is to do with "index.php?route=information/contact/captcha"
Can anyone help?
Do I have to make another modication somewhere?
Thanks,
Mel
Users browsing this forum: No registered users and 72 guests