Yoast site map not found for mulitisite config it is coming for main site not for other subdirectory site

My yoast sitmap not found, 404 error nginx easyengine config error or permissions errors.

Please tell me how to get this done for the sites. http://xxx.com/sitemap_index.xml is working but http://xxx.com/xxx/sitemap_index.xml not working.

I have added the correct rewrite rules to virtual host server block.

I am not sure why I am getting this error.

Please help me Thanks



If you are using EasyEngine then you should not add any rules explicitely. Remove rules you added. Also test by disabling other plugins.

I have tested this, and I did many changes too, No luck.

I am planning to remove Easy Engine I will go with manual set up.



At first apologies for this delayed reply

You need edit configuration to work your yoast sitemap properly

vim /etc/nginx/common/wpcommon.conf

# Comment these two lines
# rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
# rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;

#Add these two lines below above commented lines

rewrite ^.*/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^.*/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;

and then restart nginx

service nginx restart

main-sitemap.xsl not found error is coming here

I did this before

Same result!


If you could provide me your website domain name, so that i could test it properly.


I have tested for main-sitemap.xsl on my local environment, its working properly,

Let me know whether you are using EasyEngine?

I am getting hacks too because of Easy Engine,

I am sorry to say this, header information also mentioned using EasyEngine.

I am going to install LiteSpeed webserver, it will support apache rules nicely.

I would like to suggest that better to do support for apache rules on nginx or .htaccess directly.

This will be great break thorough!


Hello update on it,

Need modify xsl rewrite by adding * after ^,


Then it will works


This is my Yoast block at the moment:

# 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&sitem$

  # Following lines are options. Needed for WordPress seo addons
        rewrite ^/news_sitemap\.xml$ /index.php?sitemap=wpseo_news last;
        rewrite ^/locations\.kml$ /index.php?sitemap=wpseo_local_kml last;
        rewrite ^/geo_sitemap\.xml$ /index.php?sitemap=wpseo_local last;
        rewrite ^/video-sitemap\.xsl$ /index.php?xsl=video last;

        access_log off;

Please note: With no adjustment for news, locations etc maybe these need adjustments as well?.

At these locations:

http://yoyo.io/sitemap_index.xml (this is the base url for the multisite installation) http://loslonelyboys.com/sitemap_index.xml (this is a subsite with mapped domain)

I am recieving this error below:

This page contains the following errors:

error on line 2 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error.