Home/Blog/How to Fix XML Sitemap 404 Error in WordPress (2026)

How to Fix XML Sitemap 404 Error in WordPress (2026)

XML sitemap document with broken link chain and 404 symbol, website structure map concept

You visit yoursite.com/sitemap_index.xml and get a 404 instead of your XML sitemap. An XML sitemap 404 fix is usually a five-minute job: WordPress generates sitemaps through rewrite rules, and when those rules break, the sitemap URL stops resolving. This 2026 guide covers the fixes for Yoast, Rank Math, and core WordPress sitemaps.

Here is what is happening. WordPress does not store a physical sitemap.xml file — the sitemap URL is virtual, mapped to WordPress internals by rewrite rules. Anything that breaks rewrites (permalink issues, .htaccess problems, plugin conflicts, aggressive caching) makes the virtual URL return 404. Google Search Console then reports it cannot fetch your sitemap, which can stall indexing of new content.

What Causes XML Sitemap 404 Errors

  • Broken rewrite rules: permalinks not flushed after migration or settings change — the #1 cause.
  • SEO plugin sitemap disabled: the XML sitemap feature toggled off in Yoast/Rank Math settings.
  • Plugin conflicts: another SEO or sitemap plugin fighting over the same URL.
  • Caching: a cached 404 served for the sitemap URL even after the real fix.
  • Server config: Nginx missing rewrite rules, or .htaccess blocking .xml requests.
  • Wrong sitemap URL: checking /sitemap.xml when your plugin uses /sitemap_index.xml.

How to Fix XML Sitemap 404: 8 Steps

Step 1: Flush permalinks

Go to Settings → Permalinks and click Save Changes without changing anything. This rebuilds WordPress rewrite rules and fixes the majority of sitemap 404s instantly.

Step 2: Confirm the sitemap feature is enabled

In Yoast: SEO → Settings → Site features → XML sitemaps (on). In Rank Math: Dashboard → Modules → Sitemap (on). Then check the correct URL: /sitemap_index.xml for both Yoast and Rank Math, /wp-sitemap.xml for core.

WordPress permalink settings being saved with refresh symbol, rewrite rules concept

Step 3: Purge all caches

Clear your caching plugin, your host’s server cache, and Cloudflare/CDN cache for the sitemap URL. Then exclude sitemap URLs from caching entirely — a cached sitemap goes stale and a cached 404 lies about the fix.

Step 4: Deactivate conflicting plugins

If you run two SEO plugins or a separate sitemap plugin, deactivate one. Two plugins fighting over /sitemap_index.xml produces 404s or blank pages. Keep one sitemap source of truth.

Step 5: Check .htaccess and server rules

On Apache, ensure the standard WordPress rewrite block exists in .htaccess and no custom rule blocks .xml. On Nginx, confirm the config passes sitemap requests to WordPress (try_files $uri $uri/ /index.php?$args;) — ask your host if unsure.

Step 6: Look for security plugin blocks

Some security plugins block XML file requests as “suspicious.” Check the plugin’s logs and whitelist /sitemap_index.xml and /*sitemap*.xml.

Step 7: Test in incognito and validate

Open the sitemap URL in an incognito window. It should return HTTP 200 with XML content. Validate the XML with an online sitemap validator to catch malformed entries.

Step 8: Resubmit in Search Console

Once the sitemap loads, resubmit it in Search Console → Sitemaps. Monitor for “couldn’t fetch” errors clearing. For more Search Console fixes, see our redirect error guide.

How to Prevent Sitemap 404s

  • Always re-save permalinks after migrations, domain changes, or permalink edits.
  • Run exactly one SEO plugin’s sitemap — never two.
  • Exclude sitemap URLs from all cache layers permanently.
  • After server changes, verify the sitemap URL returns 200.
  • Monitor Search Console’s Sitemaps report monthly.

Conclusion

An XML sitemap 404 is almost always broken rewrite rules: flush permalinks, confirm the sitemap feature is on, purge caches, and resolve plugin conflicts — that sequence fixes it in minutes. Keep one sitemap source and keep it uncached, and Google will always find your content. For more WordPress SEO fixes, browse the KamiWeb blog.