I have a background in SEO and I am a perfectionist when it comes factors that could negative affect a pages ability to rank. In Google's eyes, http://www.beerpongstadium.com/about is a different page than http://www.beerpongstadium.com/about/. That said, I want all pages to end with a trailing slash. Anyone know how I could add this trailing slash at the end of URLs while keeping my urls seo friendly?
Thanks.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
It does a few things:
- It lets google know which version of the page is the actual version
- It avoids duplicate content issues and penalties associated with duplicate content (pages aren't competing to rank for the same keyword)
- It condenses "link juice," if you have links to mysite.com/page and mysite.com/page/ they are being divided rather than consolidated. Links are the biggest factor in ranking a page so every little bit helps.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
- 25 link to: http://www.mypage.com/about
- 25 link to: http://www.mypage.com/about/
- 25 link to: www.mypage.com/about
- 25 link to: www.mypage.com/about/
Then effectivley you are only gaining 25 links to a 'page' instead of the full 100 links. The page is the same as far as content is concerned, yet google does not see it as such, it sees four different pages, and in fact your site can be penalised for duplicate content issues in such a situation - you MUST have an effective .htaccess (for appache server) plan in place with permanent redirects so the user is always directed to your desired version of the url. And it's also a good idea to regularly check back links to the other url versions, and if any exist send the webmaster a nice email and ask them to change the link to your preferred format to gain the most SEO benefit available.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
regardless of anyone's opinion whether it makes a difference or not !!!
Please comment on our online Shop http://www.suncig.com.au/
If anyone could shed some light on how to modify htaccess to remove/add trailing slashes it would be greatly appreciated.
/catalog/controller/common/seo_url.php
Code: Select all
- return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url . $query;
+ return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url . $query . '/';
Code: Select all
if(substr($this->request->get['_route_'],-1) == '/') {
$this->request->get['_route_'] = substr($this->request->get['_route_'],0,-1);
}
Code: Select all
return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url . $query;
Code: Select all
return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url . $query . '/';
Code: Select all
if(substr($this->request->get['_route_'],-1) == '/') {
$this->request->get['_route_'] = substr($this->request->get['_route_'],0,-1);
}
Thanks,
Dean
Replace:
Code: Select all
return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url . $query;
Code: Select all
return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url . '/' . $query;
Thanksloki_racer wrote:This is more than a .htaccess issue. You will need to modify OpenCart to generate all links with a trailing slash as well as route them.
/catalog/controller/common/seo_url.php/catalog/controller/common/seo_url.php after line 10Code: Select all
- return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url . $query; + return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url . $query . '/';
This seems to add slashes to the product and category pages.Code: Select all
if(substr($this->request->get['_route_'],-1) == '/') { $this->request->get['_route_'] = substr($this->request->get['_route_'],0,-1); }

Code: Select all
+ return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url . $query . '/';

like this - http://shop.com// - < double slash
somebody can help me?
file: seo_url.php
line 76:
Code: Select all
$url .= '/' . $query->row['keyword'];
if ($key == 'manufacturer_id') { $url .= '/'; }
Code: Select all
if ($query->num_rows) {
// $url .= '/' . $query->row['keyword'];
$url .= '/' . $query->row['keyword'] . '/';
}
Code: Select all
// return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url . $query;
$pathurl = str_replace('/index.php', '', $url_data['path']) . $url;
return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('//','/',$pathurl) . $query;

And there's an interesting discussion on trailing slashes here:
http://stackoverflow.com/questions/5948 ... -preferred
Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 89 guests