Rankmath custom sitemap 404

#846817
  • Resolved mech perfect
    Rank Math free

    Hi, you can see website name and my custom code in sensitive data. Basically, I wrote php code for having dynamically generated pages. The pages work and properly render but they are not included in sitemap. The custom sitemap I created is returning 404. Can you please check?

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

    We apologize for the issue you are facing with your custom sitemap returning a 404 error. It seems that there might be a problem with the way the custom sitemap is set up or registered in your Rank Math configuration.

    To troubleshoot this, please ensure that you have correctly added the custom sitemap code in your child theme’s rank-math.php file and that the custom sitemap file is properly created in your child theme folder. Here’s a brief overview of what you should check:

    1. Custom Sitemap File: Make sure you have created a file named custom-sitemap.php in your child theme folder and that it contains the correct code to generate the sitemap links.

    2. Filter Code: Ensure that you have added the filter code to register your custom sitemap in the rank-math.php file of your child theme:

      include_once 'custom-sitemap.php';
      add_filter('rank_math/sitemap/providers', function( $external_providers ) {
         $external_providers['custom'] = new RankMathSitemapProvidersCustom();
         return $external_providers;
      });
    3. Permalinks: Sometimes, flushing the permalinks can help resolve 404 errors. You can do this by going to Settings → Permalinks in your WordPress dashboard and simply clicking Save Changes without making any changes.

    4. Check for Conflicts: If you have other plugins that might affect the sitemap or URL rewriting, consider temporarily disabling them to see if that resolves the issue.

    If you have checked all of these and are still experiencing issues, please reply to this ticket with any specific error messages or logs you may have, and a human agent from the Rank Math Support team will assist you further.

    Thank you for raising this concern!

    Sources:
    How to Create a Custom Sitemap and Include It in Rank Math » Rank Math

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    Thank you for contacting us. We apologize for any inconvenience this issue may have caused.

    Please follow the steps below for initial troubleshooting:

    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/

    If the issue persists then try disabling the transient cache for the sitemap. This will make sure that your XML sitemap always reflects the latest changes on your site. To do this, you need to add a small piece of code to your site’s functions.php file or use a plugin like Code Snippets.
    The code you need to add is this:

    
    /** 
     * 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/.

    After you add the code, please clear any cache on your site or server and check your XML sitemap again. If you’re still facing issues with the sitemap, please let us know – we are happy to investigate further.

    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 3 replies - 1 through 3 (of 3 total)

The ticket ‘Rankmath custom sitemap 404’ is closed to new replies.