Skip to content

Instantly share code, notes, and snippets.

@wp-seopress
Last active October 23, 2023 10:05
Show Gist options
  • Save wp-seopress/9a0add04e6f13f3a030167d3562acf32 to your computer and use it in GitHub Desktop.
Save wp-seopress/9a0add04e6f13f3a030167d3562acf32 to your computer and use it in GitHub Desktop.
NGINX rewrite rules for XML Sitemaps
location ~ (([^/]*)sitemap(.*)|news|author|video(.*))\.x(m|s)l$ {
## SEOPress
rewrite ^.*/sitemaps\.xml$ /index.php?seopress_sitemap=1 last;
rewrite ^.*/news.xml$ /index.php?seopress_news=1 last;
rewrite ^.*/video([0-9]+)?.xml$ /index.php?seopress_video=1&seopress_paged=$1 last;
rewrite ^.*/author.xml$ /index.php?seopress_author=1 last;
rewrite ^.*/sitemaps_xsl\.xsl$ /index.php?seopress_sitemap_xsl=1 last;
rewrite ^.*/sitemaps_video_xsl\.xsl$ /index.php?seopress_sitemap_video_xsl=1 last;
rewrite ^.*/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?seopress_cpt=$1&seopress_paged=$2 last;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment