0

Using some website audit tools I found that it says a lot that I have a duplicate content like so:

https://example.com/
https://example.com/index.php

in my sitemap I only have:

<url>
  <loc>https://www.example.com/</loc>
     <xhtml:link rel="alternate"
               hreflang="it"
               href="https://www.example.com/"/>
    <xhtml:link rel="alternate"
               hreflang="en"
               href="https://www.example.com/en/index.php"/>
</url>

I don't know why google splits it up into two links. How can I fix it?

(PS https://www.example.com/en/ and https://www.example.com/en/index.php doesn't give me this problem )

2
  • You should never be using index.php in your URLs. It shouldn't be in any links on your site. It shouldn't be in your sitemap. index.php is a directory index that power the page for the directory URL. The first rule of directory index is that you never talk about directory index. Commented Feb 22, 2021 at 11:01
  • @StephenOstermiller Thanks for the advice
    – NPLS
    Commented Feb 22, 2021 at 14:14

1 Answer 1

1

If you set up a 301 redirect using .htaccess to redirect https://example.com/index.php to https://example.com/ and add a canonical tag containing https://example.com/ then you don't really need to worry what the website audit tools say.

After doing this you can remove the https://example.com/index.php from your sitemap if you wish.

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.