nginx rewrites for sitemaps
-
Any idea what the difference between these two is and which one is the recommended one?
location ~ ([^/]*)sitemap(.*)\.xml$ { rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last; rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last; }
or
#Yoast sitemap location ~ ([^/]*)sitemap(.*)\.x(m|s)l$ { rewrite ^/sitemap\.xml$ /sitemap_index.xml permanent; rewrite ^/([a-z]+)?-?sitemap\.xsl$ /index.php?xsl=$1 last; rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last; rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;}
Yoast recommends the first one though: http://kb.yoast.com/article/63-xml-sitemaps-nginx but I don’t know enough to figure out the difference…
- The topic ‘nginx rewrites for sitemaps’ is closed to new replies.