Is it possible to add a trailing slash at the end of URLs?
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.
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.
while I get that about is a different page to about/ in googles eyes who ever said that the trailing slash helps seo?
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
The trailing slash helps seo because it creates only one version of the page...it's a canonical issue.
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.
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.
it has no affect whatsoever on link duplication or canonical issues. As long as all your links are the same it makes no difference if they have the trailing slash or not.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
sorry, but ozone100 is spot on, it does make a difference - a big differnce. If you have 100 inbound links and:
- 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.
- 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.
well why would any of the links go to different places if all your pages are rewritten the same? if it's just the person on the other site manually putting in the wrong url. They could just as easily put in the url without the / as to put it in with the /. My argument was never that you don't need htaccess redirects simply that weather with or without the / as long as they are always the same it doesn't matter.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
Xsecrets is correct. All that matters is that you have one format. I usually prefer www.sample.com/ for home and www.sample.com/page/ for pages. Only thing is that I don't know how to redirect it to one or the other...when working with clients their developers deal with the technical aspect. Anyone know how to automatically add the slash at the end?
I would also love to know if there's a "fix" to add a trailing slash.
regardless of anyone's opinion whether it makes a difference or not !!!
regardless of anyone's opinion whether it makes a difference or not !!!
Please comment on our online Shop http://www.suncig.com.au/
This issue is critical to SEO especially with the recent Google Panda updates. Having duplicate URLs puts your website at risk of the Google Panda penalty and can result in significant traffic loss.
If anyone could shed some light on how to modify htaccess to remove/add trailing slashes it would be greatly appreciated.
If anyone could shed some light on how to modify htaccess to remove/add trailing slashes it would be greatly appreciated.
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 10
This seems to add slashes to the product and category pages.
/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);
}
So to do this do I replace
In the seo_url.php with
Then add
On line 11?
Thanks,
Dean
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
Yes. However, please don't do this on a live site. I am currently testing it in a development environment, as you should as well.
To have all URL's be built with the trailing slash, please modify this as well
Replace:
with:
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?
This code add Trailing Slash at the end of SEO category and manufacturers directory-URLs only, not at the end of product page-URLs.
file: seo_url.php
line 76:
line 85:
line 113:
This works for me at http://www.globalmac.cl and can be done with vqmod 
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;

Has anyone figured out how to successfully add a trailing slash to the end of all SEOed pages (including product pages)? If so can you share the vqmod or code?
Yeah man, I think this is one very important aesthetic aspect. It's like organizing your stuff on your desktop, everyone has a different way of doing it. It would be great if there's a easy way to add/remove trailing slashes on pages.
And there's an interesting discussion on trailing slashes here:
http://stackoverflow.com/questions/5948 ... -preferred
And there's an interesting discussion on trailing slashes here:
http://stackoverflow.com/questions/5948 ... -preferred
Who is online
Users browsing this forum: No registered users and 140 guests