I have a single separate wordpress installation inside a subdirectory of another wordpress installation. Subdirectory's name is "blog" (This is not a multisite setup). My rewrite rules for nginx are:
location ~ ([^/]*)sitemap(.*)\.x(m|s)l$ {
rewrite ^/sitemap\.xml$ /sitemap_index.xml permanent;
rewrite ^/([a-z]+)?-?sitemap\.xsl$ /index.php?xsl=$1 last;
# Rules for yoast sitemap with wp|wpsubdir|wpsubdomain
rewrite ^.*sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^.*/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
}
Sitemap is generated for both example.com/sitemap_index.xml and example.com/blog/sitemap_index.xml but both are same and do not contain posts of the second installation in subdirectory(blog). I understand this is related to rewrite rules configuration of subfolder but I am not able to figure out what exactly the problem is. I am using Yoast plugin and have installed Yoast plugins on both the installations i.e root and subfolder separately.