I decided to switch over to WordPress SEO(Yoast) yesterday and ran into a slew of problems with their sitemap generator, a 404 error, a blank screen, and a sitemap.xml not being properly re-directed to the new sitemap_index.xml. The first problem led me to this Yoast knowledge base article, My sitemap is giving a 404 error, what should I do? I fixed the first problem by adding the code to my .htaccess file. To fix the last two problems I added the RewriteRules for the xsl statement(Line 8) and the sitemap.xml(Line 5). Now both sitemap.xml and sitemap_index.xml are being properly redirected and formatted. My Google Webmaster Tools is happy!
Note: The code below is for a WordPress blog in a sub-directory called wordpress.
# WordPress SEO - XML Sitemap Rewrite Fix RewriteEngine On RewriteBase /wordpress/ RewriteRule ^sitemap_index.xml$ /wordpress/index.php?sitemap=1 [L] RewriteRule ^sitemap.xml$ /wordpress/index.php?sitemap=1 [L] RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /wordpress/index.php?sitemap=$1&sitemap_n=$2 [L] # This rewrite ensures that the styles are available for styling the generated sitemap. RewriteRule ^/([a-z]+)?-?sitemap\.xsl$ /wordpress/index.php?xsl=$1 last; # END WordPress SEO - XML Sitemap Rewrite Fix