I've downloaded Opencart 1.50 and it looks really nice. Great job guys!
I've started fiddling with it and I already enabled and got the SEO urls for the information pages. But, what about the Contact Us, Returns, Sitemap, Brands, Gift Vouchers, Affiliates, Specials? Why can't those have SEO friendly urls? or all the other links even account, checkout? Some other eCommerce platforms all have aesthetically uniform urls...I want that with OpenCart! How can I get the /index.php?route= to SEO urls? Thanks!
Reason: Please use [version] TAG in subject!
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
this doesn't take care of pages that aren't products, categories, or information pages. my cart and my account, contact us, etc. are still all gibberishXsecrets wrote:How come we all of a sudden have tons of people asking about this? This has been a built in feature of opencart for a LONG time. You need to turn it on in the admin and rename the .htaccess.txt file to .htaccess then change the RewriteBase to / or /yourfoldername/ All of this is outlined in the install file. Are we just getting an influx of people too lazy to bother opening the install file or what?

there is a way to route all those links into clean seo-friendly URLs but it would require editing a lot of different source files. the rationale on this board is that those pages aren't important to be indexed by the search engine and some here even block the bots from indexing non-product/category pages....
why bother taking time to write decent documentation people obviously don't read what we do take the time to write.mfive wrote:Perhaps instead of blaming everyone else you could chalk it up to shitty documentation...
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
I already turned it on and renamed the .htaccess as stated in the first post. There's sorta two sets of SEO url questions people are asking or maybe are asking about both and don't realize the difference. Some people are asking about the .htaccess/seo urls. While others like me, are asking about the urls with index.php?route, which don't have instructions on how to do it.
I came across another thread that talked about being able to "Customized SEO design of ALL urls" and apparently it's already been added back in.
http://forum.opencart.com/viewtopic.php ... ncart+vote
I'm not a coder so I don't know how...thus I'm asking if anybody else knows how, help each other out in a solution and learn how to do it..etc...Right now, the only lead I have is to look into mod rewrite more to see if it can be achieved.
With .htaccess renamed, the SEO URLs enables:
the Information pages
- About Us
- Delivery Information
- Privacy Policy
- Terms & Conditions
- and any other page you make in Information
- products/categories
It does NOT enable SEO friendly URLs in:
- Home
- Wish List
- My Account
- Shopping Cart
- Checkout
- Contact Us
- Returns
- Site Map
The .htaccess instructions is not in the install.txt. It is somewhere in the Documentations page under one of the categories which you have to click through to find. For new users, it is not easy to find as you don't know the layout of OpenCart and so you wouldn't know in which category it is in. I propose that having a wiki page or changing the documentation layout to maybe a table of contents on top and all the documents on one page so people can read the table of contents, find what they need and get to that section. Another way that may help cut down on repeated posts is to include a saved documententation file with the installation.
Xsecrets wrote:How come we all of a sudden have tons of people asking about this? This has been a built in feature of opencart for a LONG time. You need to turn it on in the admin and rename the .htaccess.txt file to .htaccess then change the RewriteBase to / or /yourfoldername/ All of this is outlined in the install file. Are we just getting an influx of people too lazy to bother opening the install file or what?
the thing is if you turn off seo url's you'll notice that EVERY url has index.php?route in it.hellogoodbye wrote:sorry this turned into a tldr wall of text.
I already turned it on and renamed the .htaccess as stated in the first post. There's sorta two sets of SEO url questions people are asking or maybe are asking about both and don't realize the difference. Some people are asking about the .htaccess/seo urls. While others like me, are asking about the urls with index.php?route, which don't have instructions on how to do it.
That post was from eons ago, and If I'm not mistaken the url class that was added back in is quite different and I believe someone said not really useful for doing what was mentioned previously.I came across another thread that talked about being able to "Customized SEO design of ALL urls" and apparently it's already been added back in.
http://forum.opencart.com/viewtopic.php ... ncart+vote
The reasoning that Daniel uses for this is that search engines shouldn't be indexing account shopping cart checkout etc.I'm not a coder so I don't know how...thus I'm asking if anybody else knows how, help each other out in a solution and learn how to do it..etc...Right now, the only lead I have is to look into mod rewrite more to see if it can be achieved.
With .htaccess renamed, the SEO URLs enables:
the Information pages
- About Us
- Delivery Information
- Privacy Policy
- Terms & Conditions
- and any other page you make in Information
- products/categories
It does NOT enable SEO friendly URLs in:
- Home
- Wish List
- My Account
- Shopping Cart
- Checkout
- Contact Us
- Returns
- Site Map
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter

Can't you just use robots.txt to disallow indexing of account, shopping cart, checkout etc?
Xsecrets wrote: the thing is if you turn off seo url's you'll notice that EVERY url has index.php?route in it.
The reasoning that Daniel uses for this is that search engines shouldn't be indexing account shopping cart checkout etc.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
I'm tried and work fine for my site.
http://www.laptop-ratings.com/
and see another link like account , checkout , login ...
oc 15x easier than 14x because it just edit 1 file.
In 14x need to edit 2 file and need to load tool/seo_url before to rewite.
But in 15x no need.
there r 2 things to do.
1. edit catalog/controller/common/seo_url.php this is my code(Backup your file before edit)
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;
}
}
}
?>
query field = common/home(add another route ie. checkout/cart,checkout/checkout,information/sitemap,...)
keyword = home(or u need).
See my attach file.
Sorry for my bad english.
Good luck sir.



Attachments
url rewrite - seo-url.png (26.15 KiB) Viewed 83365 times
ร้านค้าออนไลน์
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

amdev wrote:Hi, u need to modify seo_url.php controller.
I'm tried and work fine for my site.
http://www.luxurywatchesbrands.co.cc/home
and see another link like account , checkout , login ...
oc 15x easier than 14x because it just edit 1 file.
In 14x need to edit 2 file and need to load tool/seo_url before to rewite.
But in 15x no need.
there r 2 things to do.
1. edit catalog/controller/common/seo_url.php this is my code(Backup your file before edit)
Sorry for my bad english.
Good luck sir.![]()
![]()
Here is my SQL for anyone wishing to import via phpMyAdmin
Code: 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');
- 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
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.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
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
Users browsing this forum: No registered users and 66 guests