301重定向怎么进行URL标准化设置?
经常会碰到这样的情况,其他网站链接你的站点时,会用下面的链接:www.example.comexample.com/www.example.com/index.htmlexample.com/index.php
而这样导致:你站点主域名的PR值分散到其他几个URL上。
如果你用301重定向把其他三个URL转到
www.example.com
PR也就集中在主域名:www.example.com 了。
301重定向怎么进行URL标准化设置?
设置.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]
此教程来源于《搜外网-夫唯SEO培训》,网址:https://www.seowhy.com/
本教程连接:https://www.seowhy.com/a/24.html,为原创表示感谢!