- Edited
I'm using Rank Math to generate sitemap_index.xml. But sometimes the sitemap doesn't accessible and the URL shows a 404 error. As per rank math to use sitemap on the Nginx server we have to add the below code in the configuration file. So I don't know where the file is located and in which file I have to insert that code?
`# 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`
Configuration file link - https://help.dreamhost.com/hc/en-us/articles/216455077-Nginx-configuration-file-locations/