Sitemap URL domain change.

#501748
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention.

    Can you please confirm if you want to change the base URL of your sitemap? If so, you may try adding the following filter to change that:
    https://rankmath.com/kb/filters-hooks-api-developer/#change-sitemap-base

    /**
     * Filter to change the Sitemap URL Base
     *
     * @param string $base New URL Base
     */
    add_filter( 'rank_math/sitemap/base_url', function( $base ){
    	return '/blog/';
    }, 10, 1 );

    Once done, your sitemap should look like below:

    https://yoursite.com/blog/sitemap_index.xml
    

    To learn how you can filter/hook to your WordPress site, please follow the URL I’ve shared below:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    If there’s any issue you’re encountering with your sitemap after applying the filter above please try flushing the sitemap cache by following the steps below:

    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/

    3. If the above steps doesn’t seem to work, kindly apply the following filter code to your site.

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

    Hope that helps, and please do not hesitate to let us know if you need our assistance with anything else.

    Thank you.

    Hello,
    Thanks for the reply.

    I was looking for changing sitemap entry url domain, and we added a hook for that too. But due to caching issue it didn’t work.

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

    I tried adding the above code provided in above reply and it worked.
    Thank you

    Hello,

    We are super happy that this resolved your issue. 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 https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post 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 3 replies - 1 through 3 (of 3 total)

The ticket ‘Sitemap URL domain change.’ is closed to new replies.