共计 1088 个字符,预计需要花费 3 分钟才能阅读完成。
什么是SID?就是在你的网站产品URL后面一长串的字母数字!看看上面图片,你就明白了!问题就是,SID不一定会一直出现。最常见的情况是什么呢?你可能没有使用和你在后台“Base URL” in your System> Configuration> Web interface中填入的玉米来访问你的网站.
当你发布网站的时候,你需要决定是用http://www.domain.com/ URL 或者http://domain.com/来访访问你的网站,对不对?这个很重要,而且,你最好不要经常性的改变!搜索引擎会认为这两个URL不是同一个URL,这会降低你的Page Rank。所以说,想好了要不要WWW再说吧,一旦决定,就坚持下去。
决定好了,就去后台System> Configuration> Web,在“Base URL”填入你的想用的域名 ,这样,你访问你的网站就会发现,当Base URL和你输入的域名一致的时候没有SID出现,反之就会出现SID。
Now, we want the ability that the site redirects to proper URL once accessed. Someone can place a wrong link to some forum or blog. We don’t want those links to lead to improper URL and we don’t want SIDs to appear to those visitors. Most important: We don’t want that search engines index the URLs with SIDs.
The solution is simple. Go to your .htaccess fine and find the line that says
RewriteEngine on
If you want to have www part:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
If you don’t want to have www part:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^yourdomain\.com$ [NC]
RewriteRule ^(.*)$ http://yourdomain.com/$1 [R=301,L]
Btw. This is applicable and good to be set to every site, not just Magento ones.