301重定向去掉index.html和index.php

在网站优化中,gyw5.com和gyw5.com/index.html是两个页面,虽然搜索引擎会智能判断,但是这样还是会影响网站整站的集权,为了避免蜘蛛在爬行过程中权重的流失,导致重复收录首页页面,作为一枚站长,必须学会集中权重的策略。

301重定向去掉网址尾巴方法

 .htaccess伪静态301去掉index.html尾巴 

1
2
3
RewriteCond %{HTTP_HOST} ^gyw5.com$ [NC] 
RewriteCond %{REQUEST_URI} ^/index.html [NC] 
RewriteRule .* / [R=301,L]

.htaccess伪静态301去掉index.php尾巴 

1
2
3
RewriteCond %{HTTP_HOST} ^gyw5.com$ [NC] 
RewriteCond %{REQUEST_URI} ^/index.php [NC] 
RewriteRule .* / [R=301,L]

尾巴是什么,我们就修改第二段的/index.html或/index.php为你的格式即可。