Skip to Content

WordPress SEO by Yoast XML sitemap Error

|WordPress|0 Comments

Sometimes the WordPress SEO by Yoast plugin fails to generate an XML sitemap. I’ve come across this a few times when applying it to different sites. It happens when going to SEO > XML Sitemaps > “XML Sitemap” simply brings up a 404 page. Here is a quick fix that’s worked for me every time (so far). It’s originally from this thread

Simply paste this into the top of your .htaccess file:

# WordPress SEO - XML Sitemap Rewrite Fix
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap_index\.xml$ /index.php?sitemap=1 [L]
RewriteRule ^([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 [L]
# END WordPress SEO - XML Sitemap Rewrite Fix

Then make sure to go into settings > permalinks > Save Changes (save it twice). That will reset your permalinks. That stumped me at first when it didn’t work after applying the code.

Related Posts

Share This

Related Tags

no comments yet but open for them

Post a Reply

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