有时用户输入URL时用以下三种URL均可进入主页
而不是你希望的
这样链接的PR也会传递到所有URL,如果你用301转向把前三个URL转到
PR也就集中在网页http://www.domainname.com了。
下面介绍如何在Magento中通过URL WRITE来实现301 重定向
- 在Magento根目录打开.htaccess并找到下面的注释行
<## rewrite everything else to index.php>
RewriteRule .* index.php [L]
//在该行下添写以下4句
//以下2个语句是把http://www.xxxxxxx.com/index.php重定向成http://www.xxxxxx.com
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.xxxxxxx.com/$1 [R=301,L]
//以下2句是把http://xxxxxx.com 重定向成http://www.xxxxxx.com,使之URL规则化
RewriteCond %{http_host} ^xxxxxxx.com [NC]
RewriteRule ^(.*)$ http://www.xxxxxxx.com/$1 [R=301,NC]
这样设置后用户在输入http://www.xxxxxxxx.com/index.php后,会直接301至http://www.xxxxxxx.com。
2. 进入Magento中,把BaseURL设置为http://www.xxxxxxx.com
就OK了