Hello,
We apologize for the inconvenience you are facing with your sitemap. To manually remove pages from the sitemap, you can follow these steps:
- Go to your WordPress dashboard and navigate to Rank Math > Sitemap Settings.
- Click on the “General” tab and scroll down to the “Exclude Posts” section.
- Enter the post/page ID or URL in the “Exclude Posts” field to remove it from the sitemap.
Regarding the .htaccess file not being found, this is normal if you are not using an Apache server. If your website is hosted on Nginx, it will not have an .htaccess file. Since you mentioned that your sitemap is not being cached, it’s likely that the issue is not related to caching.
If you are still experiencing issues after following these steps, please feel free to contact our support team for further assistance. We are available 24×7, 365 days a year and will help you out as soon as possible.
We hope this information helps.
Sources:
How to Fix “Incorrect HTTP Header Content-Type” Error in Sitemaps » Rank Math
Remove Blank Lines From Sitemaps » Rank Math
Rank Math Sitemap Issues and Their Fixes » Rank Math
Indexed, Not Submitted in Sitemap – Google Search Console » Rank Math
Also…
I feel like if I exclude some pages from my sitemap, that this is a bad solution. I would want my sitemap to be updated automatically.
Because other people in my team who primarily works on the website, sometimes make pages into a draft. And I will not know that.
I will only discover it when Ahref tells me.
So what will the best solution be?
Thank you for your response.
Again I feel like that me excluding pages manually in the sitemap works a little bit like a bandage. It’s not really fixing the problem. Because every time I turn a page into a draft for example, then I would have to exclude it in the sitemap.
And then when the page is activated again, I would have to go into rank math seo again to remove it from the excluded list.
So it doesn’t really fixes the root of the problem. As the sitemap needs to be automatically updated without me doing anything.
Isn’t there anything that I can do in the rank math seo plugin? Some settings or something that will solve the problems for me?
Hello,
Thank you for your patience.
Please note that the draft pages included in your sitemap are related to a caching issue.
In a typical setup, draft pages and posts are automatically removed from sitemaps generated by Rank Math.
When you set a post or page to “draft”, it is designed to update the sitemap accordingly and exclude these drafts.
However, the sitemap may still display the draft pages if your website’s cache needs to be cleared after these changes.
If that behavior is not happening on your site, then your sitemap is still cached. Please exclude the Sitemap files of the Rank Math plugin in your caching plugin. The cache could be via a plugin or from the server.
Also, disable the transient cache for the sitemap by applying this filter. This will make sure that your XML sitemap always reflects the latest changes on your site:
/**
* Filter if XML sitemap transient cache is enabled.
*
* @param boolean $unsigned Enable cache or not, defaults to true
*/
add_filter( 'rank_math/sitemap/enable_caching', '__return_false');
If you’re not sure how to add this code, you can follow this guide:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
Let us know how this goes.
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.