Hello,
I apologize for the issue you are facing with your sitemap redirecting to the homepage. To resolve this, please follow these steps:
-
Check Sitemap Configuration:
- Ensure that your sitemap is correctly configured. You can validate your sitemap using the Validate XML Sitemap tool as mentioned in our guide.
- Confirm that your sitemap is located in the root folder of your WordPress installation with only one forward slash between your domain name and sitemap path.
-
Exclude Sitemaps from Caching:
-
Check for Plugin or Theme Conflicts:
- Use the Health Check plugin to determine if there is a conflict with another plugin or theme affecting your sitemap.
If the issue persists after following these steps, please reply to this ticket, and a human agent from the Rank Math Support team will assist you further.
Thank you for bringing this to our attention.
TIA
Sources:
Troubleshooting the “Couldn’t Fetch” Error in Google Search Console » Rank Math
Rank Math Sitemap Issues and Their Fixes » Rank Math
Why the Sitemap_Index.xml is Throwing a 404 Error » Rank Math
Rank Math Sitemap Issues and Their Fixes » Rank Math
Rank Math Sitemap Issues and Their Fixes » Rank Math
Upon checking on Sitemap validator tool shared above, it is giving me following error:
Incorrect http header content-type: “text/html; charset=UTF-8” (expected: “application/xml”)
Hello,
In this case, please follow these steps:
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. 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.
Thank you so much. Issue resolved now.
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 or TrustPilot 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.