Support » Plugin: Yoast SEO » How to stop redirecting old sitemap to Yoast’s sitemap_index.xml?

  • Resolved firefly2000

    (@firefly2000)


    My old sitemap (sitemap.xml) no longer exists, so I would like my-domain.com/sitemap.xml to return a 404 error. Instead, it redirects to the sitemap_index.xml file created by Yoast. The problem with this is that Google is crawling both sitemaps, hence my desire to return 404 from the older one. How can I stop Yoast from performing this redirection?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Saša

    (@stodorovic)

    You need PHP knowledge (and experience related to WP hooks). You should unhook method template_redirect (class class WPSEO_Sitemaps_Router).

    From other side, you could try to create rules in .htaccess which blocks this file. I think that is unnecessary because you could remove sitemap.xml from GSC (and it’s probably easier and better solution).

    Plugin Support devnihil

    (@devnihil)

    We are going ahead and marking this issue as resolved due to inactivity. If you require any further assistance please create a new issue.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to stop redirecting old sitemap to Yoast’s sitemap_index.xml?’ is closed to new replies.