Plugins: XML Sitemaps
Sitemap feature is recently added to Yoast SEO plugin, so if you are using SEO by Yoast, you should rather use sitemap feature of that plugin.
Problems with nginx
For 404 error, official recommendation and also a final solution can be found here
# Wordpress Yoast SEO sitemaps
#
location ~ ([^/]*)sitemap(.*)\.x(m|s)l$ {
# redirects sitemap.xml to sitemap_index.xml, which is what Yoast's WordPress SEO plugin generates
rewrite ^/sitemap\.xml$ /sitemap_index.xml permanent;
# ensures that the styles are available for styling the generated sitemap
rewrite ^/([a-z]+)?-?sitemap\.xsl$ /index.php?xsl=$1 last;
# These are needed for Nginx webserver.
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
}
Exclude from caching in W3TC
I am not sure if this is needed anymore.
W3 Total Cache exclusions for sitemaps: use this under Page Cache (Never cache the following items), Minify (Never minify the following items), Browser Cache (404 Error Exception List), and CDN (Rejected Files) for Yoast or any XML sitemaps for WordPress.
([a-z0-9_\-]+)?sitemap(_index)?(-)?([0-9]*)?\.(xml(\.gz)?|xsl)$
SEO by Yoast + W3 Total Cache XML Site Map
https://www.save-up.ch/sitemap_index.xml
404
NOTE! IT IS NEEDED - SURELY FOR MINIFY! (as XLS in XML has problem: Specification mandate value for attribute defer)
Nginx Rewrite Rules for Yoast Sitemaps
W3 Total Cache > Browser Cache > Do not process 404 errors for static objects with WordPress
If it’s turned on, you should add the following exception: ([a-z]+)?-?sitemap.xsl
Blank: [Solved] WordPress Yoast SEO sitemap blank on Nginx
How to Submit Your WordPress XML Sitemap to Google WebMaster Tools
How to Submit Your Sitemap to Google Search Console A Bloggers Guide To Bing Webmaster Tools For SEO
Google XML Sitemaps is much better option if want more control over your sitemap.
Sitemap UI developed by a reputable developer on the mgibbs189/sitemap-ui repository, serves as a UI for the built-in WordPress native sitemap feature available at /sitemap.xml
.
WP Sitemaps Config is a more advanced tool that functions with the same included WordPress sitemaps in the same concept as the previously mentioned plugin.
10up/10up-sitemaps: Simple sitemaps plugin that performs at scale. is specific CLI tool meant to run at scale.
Slim SEO generates a Polylang multilingual sitemap by adding alternate links of posts for languages in your existing XML sitemap. This feature allows you to use only one sitemap for all languages, as detailed in their article on creating a multilingual sitemap in WordPress with WPML or Polylang. You can find more information here.