• Resolved angeloarlotta

    (@angeloarlotta)


    The sitemap returns a 404 error until I save the permalink page.
    This issue is recurring every month or even less.

    I use Litespeed caching and already set it to not cache URIs:
    /(.*)sitemap(.*).xml
    /sitemap_index.xml

    The problem still occurs. Google Search Console can’t reach the sitemap and I have to manually regenerate permalinks every time.
    If I can’t solve this issue I will revert Yoast SEO…

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @angeloarlotta,

    Thank you for contacting the support and we regret the inconvenience caused.

    It seems like you’ve not correctly excluded the sitemaps of Rank Math from the Litespeed cache. Please follow this guide to exclude it correctly: https://rankmath.com/kb/exclude-sitemaps-from-caching/#litespeed-cache

    We also suggest you add this filter to your website to completely disable the caching for the sitemaps:
    add_filter( 'rank_math/sitemap/enable_caching', '__return_false');

    Here’s how you can add the filter: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Once done, please follow the below steps and see if that helps:
    1. Flush the Sitemap cache by following this video screencast:
    https://i.rankmath.com/pipRDp

    2. Clear your website’s cache and remove all the sitemaps from your Google Search Console account, and then submit only the main sitemap: /sitemap_index.xml

    Here’s a guide with more details: https://rankmath.com/kb/submit-sitemap-to-google/

    Further, give Google some time to crawl your website again, and see if the issue gets fixed.

    Hope this helps.

    Thread Starter angeloarlotta

    (@angeloarlotta)

    Thank you for the anwser @rankmathteam but sorry, I tried both by adding:

    /(.*)sitemap(.*).xml
    /(.*)sitemap.xsl
    /sitemap_index.xsl
    /sitemap_index.xml

    or

    /(.*)sitemap(.*).xml
    /sitemap_index.xml

    to LS cache excludes.

    I also already have this filter into my functions.php:
    add_filter( ‘rank_math/sitemap/enable_caching’, ‘__return_false’);

    As I wrote, I know I can temporary solve this issue by saving the permalink page. But I can’t loose connection with the sitemap every month and check everyday if everything works as expected.

    Also can’t understand why users should add a filter in order to avoid sitemap caching. Why a sitemap should be cached by default?

    I followed all the steps listed in your message by reading about this issue on old Rank Math posts and your blog guidelines but the issue still persists…

    Let me know if you can further help otherwise I cannot use anymore the RankMath plugin on my websites.

    Thanks.

    Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @angeloarlotta,

    The sitemaps shouldn’t get cached by default, but some caching plugins do that, and you have to add the filter if the exclusion rules don’t work. If you have already added the filter and the sitemap is still cached, it means there must be a server-side caching causing the issue.

    Please get in touch with your host and ask them to make sure that sitemaps are excluded from caching. Also, remove the XML files you might have in the following folder: wp-content/uploads/rank-math

    Let us know how that goes. Looking forward to helping you.

    Hi, sorry for restart an old thread, but I have this exact issue!

    I also have the no cache exclusions in the litespeed cache plugin. When I examine the dev tools in chrome I don’t see any caching at all.
    but the thing is, every 3 or 4 weeks I find that Google search console is not reading the sitemap. I have to save the permalinks or something like that in order to make the sitemap to work again.

    generally is a 404, but in some cases conflicts with other plugins (currently with ajax search pro) and gives a white page.

    If anyone had struggled with this and managed to resolve it, I would be very grateful since this is really damaging my SERP results ??

    Thanks!

    Thread Starter angeloarlotta

    (@angeloarlotta)

    Hi @carlosvai I solved excluding the sitemap in the litespeed plugin in this way, please go to LiteSpeed Cache > Cache > [4] Excludes > Exclude Settings > Do Not Cache URIs, and insert in this field the only word “sitemap”. Hope it will work also for you.

    @angeloarlotta Thanks for replying!
    I never tried that! If this work, I will buy you a beer my friend!

    It’s a nightmare, everyday 404 until y change the number of links and save.

    Thanks again!

    Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @carlosvai,

    Thank you for contacting the support.

    Please use the following filter to fix the issue with the sitemap:
    add_filter( 'rank_math/sitemap/enable_caching', '__return_false');

    Here is how to add a filter to your site: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    And for the conflict with another plugin, since the Ajax Search Pro is preventing our sitemap from working properly, you should get in touch with their support as they might already have a fix for this.

    Looking forward to helping you.

    P.S. Please open a new support topic in case you need further assistance with the above.

    Thanks for the reply @rankmathteam
    Don’t get me wrong, I love Rank Math and will be using as usual.
    But I tried (almost) everything and once in a while I get the 404 issue.

    Last night I implemented the snippet with no success.
    But today I’m trying @angeloarlotta solution plus a Cloudflare rule to bypass the sitemap page.
    In theory, the page was not cached by CF, but this won’t hurt.

    Hopefully this will work!
    I’ll let you know.

    Thanks again!

    Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @carlosvai,

    If the issue persists, please share the URL of your site so we can check this further.

    But please do open a new support ticket.

    Looking forward to helping you.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Sitemap 404 error’ is closed to new replies.