WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
XML sitemaps with nginx. "A network error occurred loading an XSLT stylesheet" (1 post)

  1. stuartmcmillen
    Member
    Posted 7 months ago #

    My server (for the website 'stuartmcmillen.com') 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/stuartmcmillen.com
    • 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:
    http://www.stuartmcmillen.com/main-sitemap.xsl

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

    http://wordpress.org/plugins/wordpress-seo/

Reply

You must log in to post.

About this Plugin

About this Topic

  • RSS feed for this topic
  • Started 7 months ago by stuartmcmillen
  • This topic is not resolved
  • WordPress version: 3.7.1