Exclude sitemap from cache

#844113
  • Resolved Fiber
    Rank Math free

    Hi.

    My sitemaps is not updating automatically. I have to go and instead of 200 I write 201 in url number and after saving, it updates.

    could it be a cache problem?

    I use Varnish cache with Cloudpanel and it has fields for excluding. if I want to exclude folder i should write /folder/ but for files just filename.php, without “/”.

    so, how can I exclude sitemap.xml?

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

    We apologize for the issue you are facing with your sitemap not updating automatically. It does sound like it could be a caching problem.

    To exclude your sitemap.xml from being cached by Varnish, you can add the following rule in the exclusion settings:

    sitemap.xml

    This should prevent Varnish from caching your sitemap file. Since you mentioned that for folders you need to use /folder/ and for files just the filename, using sitemap.xml without any slashes should work for your case.

    Additionally, if you are using Cloudflare, it does not cache sitemaps by default, but if you have made changes that cause your sitemaps to be cached, you can set a page rule to exclude your sitemap from being cached. Here’s how:

    1. Log into your Cloudflare account and select your website.
    2. Navigate to Rules → Page Rules and click Create Page Rule.
    3. In the Page Rules settings, paste your sitemap URL in the URL field.
    4. Select Cache Level and Bypass in the dropdown menus.
    5. Click Save and Deploy Page Rule.

    If you continue to experience issues after making these changes, please reply to this ticket, and a human agent from the Rank Math Support team will assist you further. Thank you for raising this concern!

    Sources:
    How To Exclude Rank Math Sitemaps from Caching » Rank Math

    Hello,

    Thank you for contacting us and sorry for any inconvenience that might have been caused due to that.

    In order to exclude your sitemap from caching, please follow the steps below:

    1. Exclude the Sitemap files of the Rank Math plugin in your caching plugin. The cache could be via a plugin or from the server. For plugins or Cloudflare, please follow this article:
    https://rankmath.com/kb/exclude-sitemaps-from-caching/

    2. If the above step doesn’t seem to work, kindly apply the following filter to your site.

    add_filter( 'rank_math/sitemap/enable_caching', '__return_false');
    

    Here’s how you can add filter/hook to your WordPress site:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Hope that helps and please don’t hesitate to let us know if you have any other questions.
     
    Thank you.

    Fiber
    Rank Math free

    I excluded it from server and see what will happen.

    Hello,

    That is fine.

    Please update us when you check the sitemap. You can also share the sitemap URL with us so we can check as well.

    We look forward to hearing from you.

    Thank you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

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

The ticket ‘Exclude sitemap from cache’ is closed to new replies.