Sitemap add rewrite rule nginx
-
Hi,
I have exactly this problem as described in the FAQ:
https://rankmath.com/kb/fix-sitemap-issues/#nginx-server-errorI’m used to working with Apache so forgive me for my question.
I tried adding this to /etc/nginx/nginx.conf:# START Nginx Rewrites for Rank Math Sitemaps rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last; rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last; # END Nginx Rewrites for Rank Math Sitemaps
However it breaks nginx.
I also tried:server { server_name domain.com; rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last; rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last; }
No luck.
What’s the correct format of inserting a rewrite rule?
Thank you!
Viewing 15 replies - 1 through 15 (of 15 total)
Viewing 15 replies - 1 through 15 (of 15 total)
- The topic ‘Sitemap add rewrite rule nginx’ is closed to new replies.