Sitemap URL Redirecting to Homepage / 404 Error

#1101742
  • Resolved Vitri Sites
    Rank Math free

    Hello Rank Math Support Team,

    I am experiencing an issue with my sitemap. When I click on my sitemap link, it shows a 404 error and redirects to my website’s homepage:

    Sitemap URL: https://vitrisites.com.br/sitemap_index.xml

    Because of this, I am unable to submit my sitemap to Google Search Console.

    I would like to mention that previously I was using the Yoast SEO plugin, and the sitemap was working correctly. After switching to Rank Math SEO, this issue appeared.

    If you need access to any internal files of my website, such as server files, WordPress files, or WordPress admin, please let me know exactly which permissions and accesses are required.

    Could you please help me resolve this issue?

    Thank you in advance for your support.

    Best regards,

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

    We apologize for the issue you are facing with your sitemap. A 404 error when accessing your sitemap can often be resolved by flushing your permalinks. Here’s how you can do that:

    1. Go to your WordPress admin area.
    2. Navigate to Settings → Permalinks.
    3. Click the Save Changes button, even if you didn’t make any changes on the page.

    Flush permalink settings

    This should help resolve the 404 error. If the issue persists, please check if your server is configured correctly to handle the sitemap. You may need to add rewrite rules to your .htaccess file if you are using an Apache server or your Nginx configuration file if you are using Nginx.

    For Apache, add the following code 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

    For Nginx, add the following code to your configuration 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

    If you continue to experience issues, please reply to this ticket with any relevant details or access permissions needed for us to assist you further. A human agent from our support team will take over and provide more specific guidance.

    Thank you for raising this concern, and we look forward to helping you resolve it!

    Sources:
    Rank Math Sitemap Issues and Their Fixes » Rank Math

    Hello,

    You seemed to have marked this ticket as resolved.

    We’re just following up with you to see if you have any other questions or concerns that we can assist you with. Or, if your issue has been resolved, please let us know so we can mark this ticket as closed.

    Thank you for choosing Rank Math.

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

You must be logged in to reply to this ticket.