How to fix YOAST WordPress SEO sitemap 404 error

By | August 8, 2020
Usually, Yoast wordPress SEO sitemap 404 error occurs due to poor coded themes or unsupported plugins. It can be fixed easily by following simple trick.

First, check to see if you have enabled the 'Check this box to enable XML sitemap functionality.' In the wordPress SEO sitemaps setting.

If you haven’t enabled, then enable this setting then click on 'Save Changes'.  Now check your sitemap URL if it works then you don’t need to do anything. In case it doesn't works then try above steps once again.

If above trick doesn't work don’t cry. Try changing your permalink setting from setting tab.  It should work.

What if above both techniques are failed?

You don’t need to worry about that, it happens. Put below code in your .htaccess file before WordPress rewrite rules and it should works.

# Yoast SEO - XML Sitemap Rewrite Fix
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap_index.xml$ /index.php?sitemap=1 [L]
RewriteRule ^locations.kml$ /index.php?sitemap=wpseo_local_kml [L]
RewriteRule ^geo_sitemap.xml$ /index.php?sitemap=geo [L]
RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 [L]
RewriteRule ^([a-z]+)?-?sitemap.xsl$ /index.php?xsl=$1 [L]
# END Yoast SEO - XML Sitemap Rewrite Fix

Do you have any other idea to fix Yoast WordPress sitemap 404 error. Please share your thoughts in comment box below also share your experience if above tricks works for you.

Leave a Reply

Your email address will not be published. Required fields are marked *