大网数据广告活动
网站运营与故障问答

Google is counting the domain home page ("/") as a duplicate of "/index.html"

· 52CE 我爱测

For only my index pages, I am receiving this warning in Google Search Console: Duplicate, submitted URL not selected as canonical I know that this occurs because Google is attempting to track both the default landing "page" (i.e.…

问题原文

原帖链接 · Parapluie · CC BY-SA 4.0

For only my index pages, I am receiving this warning in Google Search Console:

Duplicate, submitted URL not selected as canonical

I know that this occurs because Google is attempting to track both the default landing "page" (i.e. www.domain.example/) and the page to which to which DirectoryIndex points (i.e. www.domain.example/index.html). They are, in fact, the same page, and so the warning is the result of a false positive.

Two questions for our community:

  1. Why does Google not conflate these and count them as a single page? Alternately, is there something wrong with my set up if this has happened?

  2. I can easily force both pages to point to a single canonical URL. But which is preferable, "/" or "index.html"?

已采纳解答

原帖链接 · Stephen Ostermiller · CC BY-SA 4.0

index.html should not be part of a URL that users ever see. It is a wide spread web server convention that if you want a page to show up for the directory URL, you put that page into a file called index.html. The reason that you create an index.html file is put the content at the directory URL. index.html doesn't say anything meaningful to users. The URL is always simpler and better without it.

You should never include index.html in a full absolute URL for your web site. It shouldn't be in your sitemap. It shouldn't be in any links to your site. It shouldn't be in links within your site.

  • Instead of http://example.com/index.html, use http://example.com/
  • When linking on your own site using a root relative URLs, instead of href="/index.html", use href="/"
  • When linking on your own site using directory relative URLs, instead of href="index.html" use href="./"

Google is recognizing that you have the same content on two URLs. Google knows that index.html files are meant to show content at the directory. Google is preferring to index the simpler, better URL.

You ask "Why does Google not conflate these and count them as a single page?" -- Well, Google is recognizing that those two URLs are the same page and Google is telling you which URL it chose as the one that it is going to index. Google doesn't usually index multiple URLs with the same content. See What is duplicate content and how can I avoid being penalized for it on my site?.

This does not indicate a huge problem. The worst that is going to happen is that some users see the ugly index.html in URLs. It would be better if you linked to the cleaner form and included the cleaner form in your sitemap, but it won't hurt your search engine rankings too much if you don't do it right. Google is telling you that it is taking care of the issue for you and including the cleaner version in its search index.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2019-04-17)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。