Support » Plugin: Yoast SEO » XML sitemaps with nginx. "A network error occurred loading an XSLT stylesheet"

  • My server (for the website ‘’) uses nginx, and Yoast’s SEO plugin is giving me the following message within /wp-admin/

    As you’re on NGINX, you’ll need the following rewrites:

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

    After about an hour of googling to find out exactly how to do this (there doesn’t seem to be a single clear guide for noobs like me), here’s what I did:

    • Opened the file /etc/nginx/sites-enabled/
    • Saw that there was already a ‘server block’ inside the file. i.e. server{}
    • Copied and pasted the following code within the server block:
    #	Fix Yoast SEO Sitemaps
            rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
    	rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;

    (note: I didn’t add anything to /etc/nginx/nginx.conf , as there wasn’t a ‘server block’ within that file already. ‘Server’ is not mentioned anywhere right now. Let me know if I should have added something to this file.)

    I then logged into my server via ssh/Terminal and did this command to make nginx reload:

    nginx -s reload

    Before updating my the server block, all I was getting for my sitemap was a 404 error message.

    Now, my sitemap_index.xml is showing:

    Error loading stylesheet: A network error occurred loading an XSLT stylesheet:

    Can someone suggest what is going wrong, and how I can fix it?

  • The topic ‘XML sitemaps with nginx. "A network error occurred loading an XSLT stylesheet"’ is closed to new replies.