經常會碰到這樣的情況,其他網站鏈接你的站點時,會用下面的鏈接:
www.example.com
example.com/
www.example.com/index.html
example.com/index.php
而這樣導致:你站點主域名的pr值分散到其他幾個urls了。
如果你用301重定向把其他三個URL轉到
www.example.com?
PR也就集中在主域名:www.example.com?了。
301重定向具體辦法:
設置.htAccess文件(只適用于linux系統,并需要虛擬主機支持。)
使訪問example.com/的時候就會自動轉到www.example.com?
在.htaccess文件里寫上以下代碼即可。
RewriteEngine on
RewriteCond %{http_host} ^mydomain.com [NC]
RewriteRule ^(.*)$?http://www.mydomain.com/$1?[L,R=301]
注意:URL標準化的301重定向(以上代碼)需要寫在其他URL-rewrite代碼之前。
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END