2016-08-19 203 views
1

我最近将我的网站页面更改为.php 在我将重写规则显示为example.com/index.html之前,我以example.com/301将index.html重定向到index.php,并从url中隐藏index.php

现在我想的一样,但与重定向到index.php

我尝试的东西,但我有一个循环结束了.. 什么是做了正确的方法是什么? 所有这一切都是为了防止谷歌采取index.php作为一个新的页面,而不是index.html 的演变我想用htaccess所有这一切,我已经这样做了每个其他页面:

重定向301 /old-url-name.html http://www.example.com/new-url-name.php

还..是有办法隐藏从各自的文件夹中所有的index.php?

回答

0

为了防止谷歌索引从两个URL必须使用canonical meta标签:

<link rel="canonical" href="https://www.example.com/" /> 

从index.php文件重定向是不需要的,只是没有在任何地方你的网站链接的index.php页面。换句话说,替换此:

<a href="https://www.example.com/index.php">Home</a> 

与此:

<a href="https://www.example.com/">Home</a> 
+0

但我删除我的老HTMLS,我读了正确的方式做到这一点是与301重定向。链接示例是一个很好的提示,谢谢 – AngelLestat

相关问题