My sitemap is giving a 404 error, what should I do?
Is your sitemap giving a 404 error? This article will take you through the steps you should follow to fix this error. First of all, we’d like to inform you that this is usually not due to our plugin, but due to poorly coded themes and/or other plugins. A 404 error basically means that the sitemap index or individual sitemap does not exist for a variety of reasons.
You can solve the 404 error by following the steps below.
1. Update the permalink structure
First of all, sometimes resetting the permalink structure will quickly solve a 404 error from a recent change to your installation. Go to Admin > Settings > Permalinks and click save without altering anything. For more, information, see this how-to guide.
2. No content for the sitemap
Second, check that items exist in order to create the individual sitemap. For example, a category sitemap requires categories with published content. If the items do not exist, exclude the post type or taxonomy from the sitemap until you create content. For more information, see this how-to guide.
3. Rewrite rules are missing
If you still receive a 404, check the rewrite rules for your server. If you are not sure how to check for the rules below, which server you are using, or how to enter them, please contact your host provider.
Using Apache server
This article has more advice on troubleshooting the sitemaps on Apache servers: Yoast XML Sitemaps on Apache servers.
Using NGINX server
This article has more advice on troubleshooting the sitemaps on NGINX servers: Yoast XML Sitemaps on NGINX servers.
4. Check to see if sitemaps have been enabled
Finally, make sure to check if you have enabled sitemaps in Yoast SEO.