网络营销电子商务研究中心

网络营销电子商务研究中心 (https://www.0058.net/index.php)
-   X-Cart (https://www.0058.net/forumdisplay.php?f=70)
-   -   X-Cart SEO Urls: Don't Slash Away Your X-Cart SEO Rankings (https://www.0058.net/showthread.php?t=5057)

Xzavier 2015-03-31 12:48 AM

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/


All times are GMT +8. The time now is 02:01 AM.

Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.