Hello,
Thank you for contacting us and sorry for any inconvenience that might have been caused due to that.
Please note that our plugin doesn’t remove the URLs with redirections from the sitemap by default.
If you are redirecting the page to a different one, you will need to set the old page to noindex by following this guide to remove it from the sitemap: https://rankmath.com/kb/how-to-noindex-urls/
After that, you can follow the steps below to clear your sitemap cache:
1. Flush the Sitemap cache by following this video screencast:
https://i.rankmath.com/pipRDp
2. 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/
Hope that helps and please don’t hesitate to let us know if you have any other questions.
Â
Thank you.
Hi Rakibuzzaman Siam
Thanks so much for the reply. The page is still the same. All we did was update the page title and slug. So if I set the page to no-index, it will also remove the new URL from the index.
Is there anything else I can do to remove the old URL from the sitemap?
Looking forward to your reply,
Chloe
Hello,
In this case, please try adding this filter to remove the URL manually on your sitemap:
add_filter( 'rank_math/sitemap/entry', function ( $url, $type, $object ) {
$urls_to_skip = array(
'https://yourdomain.com/redirected-URL-1' // URL to be removed
);
if ( isset( $url['loc'] ) && in_array( $url['loc'], $urls_to_skip ) ) {
return false;
}
return $url;
}, 10, 3 );
Please change the URL to the actual old page URL in the code.
And here’s how you can add a filter/hook to your WordPress site:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
Let us know how this goes.
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.