Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared Managed Cloud India
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Best lists Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Troubleshooting · Troubleshooting

How to Fix a Yoast Sitemap Returning 404

Short answer

Open your sitemap at /sitemap_index.xml and note whether you see a WordPress 404 page. Go to Settings > Permalinks and click Save Changes without changing anything, then reload the sitemap. If it still returns a 404, check that XML sitemaps are switched on under Yoast SEO > Settings > Site features.

Key takeaways

  • Yoast SEO builds its sitemap on the fly, so a 404 means the address is not being routed to WordPress.
  • Re-saving permalinks rebuilds the rewrite rules and fixes most Yoast sitemap 404s in under a minute.
  • A sitemap at /sitemap.xml is usually made by another plugin or WordPress core, not by Yoast.
  • Post types marked noindex never appear in a Yoast sitemap, and an empty sitemap is not the same as a 404.
  • Google does not index URLs that return a 4xx status, so a broken sitemap index can slow down discovery of new posts.

What does a 404 on a Yoast sitemap mean?

A 404 on your Yoast sitemap means the server cannot find the sitemap address, even though Yoast SEO is active on your site.

Yoast SEO builds its sitemaps on the fly instead of saving a file on your server. The main address is /sitemap_index.xml, and it lists smaller sitemaps for posts, pages, and other content types. Yoast's XML sitemaps guide says the sitemaps update automatically as you add or remove content.

A 404 does not mean your posts are gone. It means the address is not reaching the code that builds the sitemap. Google's crawler documentation says Google does not index URLs that return a 4xx status, and it removes already indexed URLs that start returning one.

Which sitemap address should you test first?

Test /sitemap_index.xml first, because that is the address Yoast SEO uses for its sitemap index.

Open it in a private browser window so a cached copy does not hide the real result. A working sitemap shows XML, which looks like a list of links or smaller sitemaps.

A broken one shows your theme's 404 page, a blank page, or your home page. Yoast's 404 help page notes that a sitemap at /sitemap.xml is probably made by another plugin or by WordPress core, not by Yoast.

Check your robots.txt file too, since it usually names the live sitemap in a Sitemap line. If robots.txt points to /wp-sitemap.xml while Yoast is active, you may be testing the wrong address.

If the address in robots.txt ends in sitemap.xml rather than sitemap_index.xml, it belongs to a different sitemap tool, so fix that tool's settings instead of Yoast's.

Stale permalink rules cause most Yoast sitemap 404s, because the sitemap address only works when WordPress rewrite rules send it to the sitemap code.

WordPress stores rewrite rules in its database and, on Apache servers, in the .htaccess file. A move to a new host, a plugin change, or a failed update can leave those rules out of date.

The sitemap address then has no matching rule, so the server returns a 404. WordPress.org's permalinks documentation notes that visiting the Permalinks screen triggers a flush of the rewrite rules.

  1. Go to Settings > Permalinks in your WordPress dashboard.
  2. Leave the structure exactly as it is and click Save Changes.
  3. Reload /sitemap_index.xml in a private browser window.

This step takes under a minute and fixes the largest share of cases. Yoast's own 404 guide lists resetting the permalink structure as the first step. If your site runs on Nginx, there is no .htaccess file, so ask your host to check the server rewrite rules.

If permalinks are broken across the whole site, not just the sitemap, see our guide to fixing broken permalinks.

How do you check that Yoast sitemaps are turned on?

Check the XML sitemaps toggle in Yoast SEO, because the sitemap returns a 404 when the feature is switched off.

Go to Yoast SEO > Settings > Site features in your dashboard. Under Technical SEO, slide the XML sitemaps toggle to On, then click View the XML sitemap on the same screen.

Yoast's sitemaps guide says a purple checkmark appears when the feature is enabled, and that the sitemaps update automatically as content changes.

The menu path has changed between Yoast SEO versions, so update the plugin first if your screens look different. After switching the feature on, re-save your permalinks once more so the rewrite rules include the sitemap addresses.

What if only one sitemap in the index returns a 404?

A single sitemap returning a 404 usually means that content type has no items to list, or it is set to noindex.

Yoast SEO only builds a sitemap for a post type or taxonomy when it has published items that search engines may index. Yoast's 404 guide says to check that items exist first, and to exclude the post type until you create content.

Post types marked noindex never appear in the sitemap at all. Yoast's sitemaps guide states this plainly, so an empty or missing sitemap for a noindex type is normal, not an error.

Open the sitemap index and click the child sitemap that fails, such as post-sitemap.xml or page-sitemap.xml. If the index loads but one child 404s, publish a post of that type or check its visibility settings.

If every child sitemap 404s, the problem is with the index itself, so go back to the permalink and feature checks above.

How do you find a plugin or theme conflict?

A second SEO plugin, a sitemap plugin, or a caching plugin can take over the sitemap address and return a 404.

Two sitemap tools on one site often register the same address, and neither one wins cleanly. Yoast's sitemaps guide advises disabling other sitemap plugins and removing any physical sitemap files first.

A static sitemap_index.xml file left on the server can also shadow the live sitemap, so check your site root over FTP or your host file manager.

  1. Deactivate every SEO and sitemap plugin except Yoast SEO.
  2. Clear the cache in your caching plugin, your host panel, and any CDN.
  3. Reload /sitemap_index.xml in a private window.
  4. Reactivate the other plugins one at a time, reloading the sitemap after each one.

The plugin that brings the 404 back is the conflict. Keep one sitemap tool active and remove the other, or switch off its sitemap feature if it has one. WordPress.org's common errors guide recommends the same one-by-one method for plugin conflicts of any kind.

If the same clash affects Rank Math instead, see our guide to fixing a Rank Math sitemap.

What server settings can block a Yoast sitemap?

Missing rewrite rules, a disabled mod_rewrite module, or a security rule can block the sitemap even when WordPress settings are right.

On Apache, the mod_rewrite module carries out the rewrite rules in .htaccess. WordPress.org's common errors guide says that 404s with pretty permalinks can mean mod_rewrite is not enabled.

The fix is to reset permalinks first, then ask your host to turn the module on. On Nginx, rewrite rules live in the server configuration, which only your host can change.

File permissions matter too. If WordPress cannot write to .htaccess, saving permalinks shows a message that says you should update your .htaccess now, with the rules to copy in by hand. WordPress.org's permalinks documentation explains both messages and what each one means for your next step.

SymptomLikely causeFirst check
Sitemap index 404sStale rewrite rulesRe-save permalinks
Only one child sitemap 404sEmpty or noindex post typePublish a post or check visibility
Sitemap shows your home pageStatic file or cacheDelete the static file, clear the cache
Sitemap works for you, 404s for GoogleFirewall or security ruleCheck the security plugin log

Security plugins and firewalls can also block sitemap requests, especially from crawlers. If the sitemap loads in your browser but Google Search Console reports a 404, check the firewall event log for blocked requests to .xml addresses.

MDN's 404 reference notes that a 404 only says the resource is missing, so the log is what tells you which layer answered.

How do you confirm the fix and resubmit the sitemap?

Confirm the fix by opening the sitemap index in a private window and checking that it returns XML with a 200 status.

Use your browser's developer tools or a header checker to confirm the status code, since a page can look right while still returning a 404 status. Every child sitemap in the index should load as well.

  1. Open Google Search Console and go to Sitemaps.
  2. Remove the old sitemap entry if it shows an error, then submit /sitemap_index.xml again.
  3. Wait a few days and check the Sitemaps report for a success status.

Yoast SEO adds an x-robots-tag header with a value of noindex, follow to its sitemap responses. Yoast's sitemaps guide explains that sitemaps do not need to be indexed to be read, so do not worry if the sitemap itself never appears in search results.

If other WordPress sitemaps are broken too, our guide to fixing a sitemap that returns an error covers the general case.

What mistakes should you avoid?

Most Yoast sitemap 404s come back to one of three things: stale rewrite rules, a switched-off feature, or a second sitemap tool. Work through them in that order and you will find the cause in minutes.

  • Do not edit .htaccess by hand before trying a permalink re-save, since a typo there can break the whole site.
  • Do not run two SEO plugins at once, since each one tries to own the same sitemap address.
  • Do not upload a static sitemap file to fix a missing one, since it can shadow the live sitemap.
  • Do not resubmit the sitemap to Search Console until the index itself returns a 200 status.

Frequently asked questions

Why does my Yoast sitemap 404 after I move my site to a new host?

A move often leaves the rewrite rules out of date, so the sitemap address has no matching rule on the new server. Re-save your permalinks first, then check that the sitemap feature is on. If the 404 stays, ask your host to check the server rewrite rules and confirm that the module that runs them is enabled.

Why does my sitemap work in my browser but show an error in Google Search Console?

A cache or firewall can serve your browser a good copy while blocking Googlebot, or the other way around. Open the sitemap in a private window, clear every cache layer, and check the firewall log for blocked requests. Then remove the old entry in Search Console and submit the sitemap again.

Should I use /sitemap.xml or /sitemap_index.xml with Yoast SEO?

Use /sitemap_index.xml, because that is the address Yoast SEO uses for its sitemap index. An address ending in /sitemap.xml usually belongs to another plugin or to WordPress core. Check which tool owns the address before you change any settings, so you fix the right one.

Does a 404 sitemap hurt my search rankings?

A broken sitemap does not remove your posts from search results by itself, but it slows down discovery of new and changed pages. Google does not index URLs that return a 4xx status, and it drops indexed URLs that keep returning one. Fix the sitemap, then resubmit it so crawlers can find your new content again.

Can I fix a Yoast sitemap 404 without touching code?

Yes, in most cases. Re-saving permalinks, switching the sitemap feature on, clearing caches, and removing a conflicting plugin need no code at all. You only need to edit files if WordPress cannot write to .htaccess, and your host can do that step for you.

Sources

  1. My sitemap is giving a 404 error, what should I do? Yoast
  2. XML sitemaps in the Yoast SEO plugin Yoast
  3. Settings Permalinks screen WordPress.org
  4. Common WordPress errors WordPress.org
  5. How HTTP Status Codes Affect Google's Crawlers Google Search Central
  6. 404 Not Found MDN Web Docs

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

WPLegible editors

Researched from the primary sources listed above and checked against our editorial rules. About the site · How we test