Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save omurphy27/54019c7fbd24e9268a8c to your computer and use it in GitHub Desktop.
Save omurphy27/54019c7fbd24e9268a8c to your computer and use it in GitHub Desktop.
Yoast - Wordpress SEO - Sitemap 404 page missing error .htaccess
// For when the yoast wordpress SEO sitemap is throwing up a 404 page
// more info here: https://kb.yoast.com/kb/my-sitemap-index-is-giving-a-404-error-what-should-i-do/
// Enter into the htaccess file BEFORE the standard WP rewrite stuff
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment