1

I normally serve pages from my (static content) website without the .html extension in the URL.

I recently had a bug in my web server's configuration for a couple days where it did serve pages with the .html extension. The google crawler seems to have picked up on those pages and now in the search console it shows duplicate pages, both with and without the .html extension.

I went back and added <link rel="canonical"> to the affected pages, but google search console still indexes some of the pages with .html extensions separately. Is there any way to force the search console to ignore duplicate pages that have the .html extension?

1 Answer 1

1

If they are still getting indexed, then there are links to it, either internal or external ones.

  • Remove/change all internal links that have .html
  • Ensure that you are either rewriting these urls to non html ones or returning 404.
2
  • Thanks for the suggestion. Unfortunately, my web server has a limitation that even though I only link to non-.html pages, it will still serve the page if the URL request has a .html extension. I thought that if I added the <link rel="canonical"> it would effectively be the same as a redirect, but it sounds like a redirect would be better?
    – crimson73
    Jun 3, 2023 at 15:05
  • Yes, a rewrite or a redirect would be better. As long as the url returns a valid page, it could be indexed. And canonical is a just a request to Google, it can ignore it and index the .html instead. Please provide details on your server for a more targeted response. You can either edit the question to do so, or ask a new question. Jun 4, 2023 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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