Problem with sitemap.xml

  • Resolved David

    Hello, I’m having problems with sitemap.xml and the following notification has appeared in my Sitemap Settings:
    “Since you are using NGINX, add this code to your NGINX configuration file if your Sitemap pages are not loading or you can ask your hosting support to add it.”

    # START Nginx Rewrites for Rank Math Sitemaps
    rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
    rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
    # END Nginx Rewrites for Rank Math Sitemaps

    Any solution? Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for the delay and for any inconvenience this issue may have caused you.

    Rank Math creates a virtual Sitemap dynamically when you enable that module. We rely on redirects enabled by your server software to accomplish that. If the Sitemap doesn’t work, you may need to add those codes manually.

    To ensure you need to add these rewrite rules, go to If it loads your sitemap, that means you need to add the rewrite rules.

    If you’re not sure how to add these redirects, you can get in touch with your web host for further assistance.

    I hope that helps. Thank you, and looking forward to your update.

    It hasn’t worked. If I press Ctrl + u on my sitemap page, it appears but without styles. How could I fix it? Thanks.


    Thank you for the update, and sorry for the delay.

    It seems like the site map is heavily cached by the W3 total cache plugin. You can see the code below in the page source code of your sitemap.

    To fix this, please follow the steps below:

    1. Flush the Sitemap cache by following this video screencast:

    2. Exclude the Sitemap files of the Rank Math plugin in your caching plugin:

    I hope that helps. Thank you, and looking forward to your update.

    Thank you for resolve my problem, it has work!


    We are super happy that your issue is resolved. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)

The ticket ‘Problem with sitemap.xml’ is closed to new replies.