Support » Fixing WordPress » Yoast SEO – requires rewrite for XML Sitemap?

  • Hello,

    I am trying to use WordPress SEO optimisation by Yoast. When I ask the plug-in to automatically generate a XML Sitemap, I am presented with the following message:

    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;

    I was wondering if anyone could tell me in which file/document I would place these rewrites? What I would be rewriting?

    I am new to webs development, and do not really know that much.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Rewrite rules go into the .htaccess file which should be located in your root web folder public_html/.htaccess
    You can also set the permission via your FTP client to writeable (666) yoast’s seo plugin will automatically add the rewrite rules to your htaccess file then.

    Could you tell me, do I just place these rewrite files anywhere in the .htaccess doc? Or do they need to be in a specific page?
    Also, I just presumed, that they actually had to rewrite something, or inserted in place ofsome existing code? Is that not the case?

    Those rewrite rules only work in the .htaccess file. You don’t need to add the code to any wordpress generated page or post.

    Can you please check if you got the .htaccess file in your root folder?
    if yes: keep every line in that file and add the lines from yoasts seo plugin to the bottom; save and reupload. Your sitemap should be working then.

    Thanks! I used one of the plug-ins to allow you to view and edit your .htaccess file wihtin your WordPress dashboard. I then added the rewrite code after the section of text which said #Wordpress rewriete start #Wordpress rewrite end. The plug-in now works fine and my sitemap has been generated.

    cool! glad you got it working.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Yoast SEO – requires rewrite for XML Sitemap?’ is closed to new replies.