Search code examples
sitemapgoogle-search-consolecanonical-link

Is this XML sitemap correct where two URLs in fact point to the one file?


I have the following XML sitemap:

   <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9  http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
    <url>
        <loc>https://www.skyeshepherdhuts.co.uk/</loc>
        <lastmod>2024-12-29</lastmod>
    </url>
    <url>
        <loc>https://www.skyeshepherdhuts.co.uk/welcome</loc>
        <lastmod>2024-12-29</lastmod>
    </url>
    <url>
        <loc>https://www.skyeshepherdhuts.co.uk/our-huts</loc>
        <lastmod>2024-12-27</lastmod>
    </url>
    <url>
        <loc>https://www.skyeshepherdhuts.co.uk/booking</loc>
        <lastmod>2024-12-29</lastmod>
    </url>
    <url>
        <loc>https://www.skyeshepherdhuts.co.uk/faq</loc>
        <lastmod>2024-12-24</lastmod>
    </url>
    <url>
        <loc>https://www.skyeshepherdhuts.co.uk/details</loc>
        <lastmod>2024-12-28</lastmod>
    </url>
   </urlset>

The URLs ending in "/" and in "/welcome" point to the same file. This is done by an Apache .htaccess URL-rewrite, effectively a redirection.

I have three questions: (1) Is the sitemap correct?

The file "/welcome" has a link rel="canonical" to the file "/".

(2) Is this correct, or should I do this the other way around, setting the canonical to "/welcome" ?

Google Search Console is not happy, giving me a "Duplicate, Google chose different canonical than user" error, iirc.

(3) How do I fix this error? I am aware of the various controls in Google Search Console to allow resubmission of site maps and re-validation concerning this error.


Solution

  • Having two URLs with the same content is a different issue. They will compete with each other.

    I suspect you want to drop or redirect the /welcome and have that content only on your home page. Then update all links to /welcome so they go directly to the home page.