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"?

  • 1
    "to which it has been redirected" - Are you redirecting from one URL to the other? (But your #2 suggests you are not?) Which URL are you linking to?
    – MrWhite
    Apr 17 '19 at 16:36
  • When you visit a web site that ends with a slash, it means you are visiting a directory. Every directory should have an index of the contents within that directory, hence, the index.html file. yoursite.com/ will automatically, first, search for an index file but index.html is also the contents of '/'.
    – Rob
    Apr 17 '19 at 18:35
  • @Rob Exactly. To me, and the all site visitors, all is working well. My only concern is that Google Search Console sees this as a duplicate URL. I would like to have one of these point to the other as the canonical version, instead of marking both as canonical. Does this make sense, or should I alter my approach?
    – Parapluie
    Apr 17 '19 at 19:56
  • You shouldn't be doing anything. Do not redirect one to the other because a directory is not a file and index.html is a file.
    – Rob
    Apr 18 '19 at 1:08
  • I think "redirect" was the wrong word to use. I will clarify the language above. My apologies: I work in an environment where I routinely translate these things for non-tech people, and I think I was stuck in that mode.
    – Parapluie
    Apr 18 '19 at 13:54

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.

  • Thank you, Stephen. You have explained this very clearly, even though my opening post may have misdirected others through its obtuse language :-P I will have my sitemap include example.com/ and not even mention example.com/index.html. It now seems very common-sense – after I had it carefully illustrated to me, haha!
    – Parapluie
    Apr 18 '19 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.