How to have /sitemap.xml redirect to /sitemap_index.xml

#711179
  • Resolved Mark Yang
    Rank Math free

    Hello,

    I noticed with my website, when I have /sitemap.xml after .com, it redirects to the home page instead of.com/sitemap_index.xml. While my competitors also use Rankmath, having /sitemap.xml redirected to the /sitemap_index.xml instead of their home page.

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

    I’m sorry to hear that you’re experiencing issues with your sitemap redirection. To have /sitemap.xml redirect to /sitemap_index.xml, you will need to add some rewrite rules manually to your server configuration.

    If you are using an Apache web server, you can add the following rewrite rules to your .htaccess file:

    # START of Rank Math Sitemap Rewrite Rules
    RewriteEngine On
    RewriteBase /
    RewriteRule ^sitemap_index.xml$ /index.php?sitemap=1 [L]
    RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 [L]
    RewriteRule ^([a-z]+)?-?sitemap.xsl$ /index.php?xsl=$1 [L]
    # END of Rank Math Sitemap Rewrite Rules

    If you are using an Nginx web server, you can add the following rewrite rules to your Nginx config file:

    # START Nginx Rewrites for Rank Math Sitemaps
    rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
    rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
    rewrite ^/([a-z]+)?-sitemap.xsl$ /index.php?xsl=$1 last;
    # END Nginx Rewrites for Rank Math Sitemaps

    Please ensure that you add these rewrite rules correctly to your server configuration. If you’re not sure about adding these rules, I recommend reaching out to your server administrator or hosting support for assistance.

    Let me know if you need further help with this!

    Sources:
    Rank Math Sitemap Issues and Their Fixes » Rank Math
    Why the Sitemap_Index.xml is Throwing a 404 Error » Rank Math
    Multilingual SEO with Rank Math SEO & WPML » Rank Math
    How to Configure Sitemaps in Rank Math – Best Settings and Tips
    How to Submit a Sitemap to Google » Rank Math

    Mark Yang
    Rank Math free

    Hello,

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

    Thank you.

    Mark Yang
    Rank Math free

    Is there an API rankmath provides that allows me to pull from thesitemap onto a page. I’ve had to do this manually which I prefer not to. YOAST seems to offer this and wondering if Rankmath can do the same.

    Hello,

    Thank you for your query, and we are so sorry about the trouble this must have caused.

    We checked the sitemap at golfleap.com/sitemap.xml and we can see that it redirects as expected to golfleap.com/sitemap_index.xml

    Please refer to the screenshot below :
    https://monosnap.com/direct/mcfUcIKCVmSRDuaXHoygbh4Lfdp9lu

    We also checked the HTML sitemap page at https://golfleap.com/golf-leap-sitemap/ and we can see that it loads as expected.

    Please refer to the screenshot below :
    https://monosnap.com/direct/kKN3AT3aN2NHWRDzMEIcIne64i5K4x

    Could you please elaborate what is the issue you are facing at your end now ?

    Is this resolved or do you still need assistance on this ?

    You can use tools like Imgur (https://imgur.com/upload) to upload the screenshots or you can use tools like Loom (https://www.loom.com/screen-recorder) to record and upload the screencasts and share the generated links here.

    We really look forward to helping you.

    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.

Viewing 4 replies - 1 through 4 (of 4 total)

The ticket ‘How to have /sitemap.xml redirect to /sitemap_index.xml’ is closed to new replies.