Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save eyvoro/2b1fbe43d2a3153531aef71dff3fbba2 to your computer and use it in GitHub Desktop.
Save eyvoro/2b1fbe43d2a3153531aef71dff3fbba2 to your computer and use it in GitHub Desktop.
Nginx rewrites for Yoast's WordPress SEO plugin. These rewrites go into the Nginx host file between the server blocks.
# This rewrite redirects sitemap.xml to sitemap_index.xml, which is what Yoast's WordPress SEO plugin generates.
rewrite ^/sitemap\.xml$ /sitemap_index.xml permanent;
# This rewrite ensures that the styles are available for styling the generated sitemap.
rewrite ^/([a-z]+)?-?sitemap\.xsl$ /index.php?xsl=$1 last;
# These rewrites rule are generated by Yoast's plugin 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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment