WordPress.org

Ready to get started?Download WordPress

Forums

Yoast SEO - requires rewrite for XML Sitemap? (6 posts)

  1. DanielFinn
    Member
    Posted 1 year ago #

    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.

  2. gerald@WPcustoms
    Member
    Posted 1 year ago #

    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.

  3. DanielFinn
    Member
    Posted 1 year ago #

    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?

  4. gerald@WPcustoms
    Member
    Posted 1 year ago #

    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.

  5. DanielFinn
    Member
    Posted 1 year ago #

    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.

  6. gerald@WPcustoms
    Member
    Posted 1 year ago #

    cool! glad you got it working.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.