网址 http://www.example.com/和 http://www.example.com/index.html两者都显示相同的网页。但是搜索引擎将它们视为 2 个不同的 url。因此,页面排名会出现 split 并影响 SEO。
网络搜索得到的可能解决方案:
1.Use DirectoryIndex index.html in the .htaccess file.
这告诉搜索引擎 http://www.example.com/和 http://www.example.com/index.html是一样的。
我面临的问题:.htaccess 文件中的 DirectoryIndex index.html 期望所有子文件夹也有 index.html 文件。前任。如果根目录中有一个文件夹“blog”,其中没有 index.html 文件,那么 url “http://www.example.com/blog/”抛出索引未找到错误。
2.using 301 redirect. Redirect http://www.example.com/index.html to http://www.example.com/
问题:重定向会增加加载时间。这不是一个好的做法。
请建议哪种解决方案更好?我怀疑第一个是否是解决方案。 另外,如果我必须重定向,重定向 http://www.example.com/index.html至 http://www.example.com/在 SEO 方面哪个更好,反之亦然?
最佳答案
只需使用 canonical URLs .这将很容易地解决问题。如有必要,您还可以执行从 index.html 到/的 301 重定向,因为这也会完成同样的事情。
关于seo - url规范化怎么解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10799856/