
Rank Mathis the SEO plugin currently used by Naiba. It comes with a built-in sitemap feature. Today, while configuring it for a client, I found that accessing index_sitemap.xml resulted in a 404 error. Here is a record of the solution.
This issue is usually caused by incorrect pseudo-static configuration, just add the following rules to the virtual host configuration file.
Nginx configuration is as follows:
# 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
The Apache configuration is as follows:
# 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
Similar issue: