View Single Post
  #1   IP: 112.87.93.182
Old 2015-03-31, 12:48 AM
Xzavier Xzavier is offline
初级会员
 
Join Date: 2010-12-14
Posts: 4
Xzavier 现在声名狼藉
Default X-Cart SEO Urls: Don't Slash Away Your X-Cart SEO Rankings

Google Webmasters recently provided a tutorial on utilizing slashes in urls: To Slash or not to slash.

If using our CDSEO for X-Cart search engine optimization X-Cart mod or the default X-Cart clean urls, you likely have folder urls for categories and/or manufacturers, and you may or not be utilizing slashes correctly.

Search engines will see a url with a slash as a folder, and without a slash as a file, as follows:

http://www.example.com/some-directory <- file
http://www.example.com/some-directory/ <- folder

What's more important than which method is used, is that both of these urls not be used to access the same content. Instead you want pick one url format and 301 redirect the secondary url to the primary.

I recommend using the conventional folder format as provided by CDSEO. You can then ensure that the the url without a slash is 301 redirected to the url with a slash using this code at the top of your .htaccess file:
Code:
# WCM - Force trailing slashes
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/[^\.]+[^/]$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R=301,L]
# / WCM - Force trailing slashes
Test the url both with and without the slash at http://web-sniffer.net/ to ensure your response codes are as follows:

http://www.example.com/some-directory -> Status: HTTP/1.1 301 Moved Permanently
http://www.example.com/some-directory/ -> Status: HTTP/1.1 200 OK

You can see this working on our site by testing the following urls:

http://www.glassespeople.com/eyeglasses
http://www.glassespeople.com/eyeglasses/
Reply With Quote