VPS主机与服务器★ 4.6 推荐评级

Rank Math站点地图文件index_sitemap.xml 404错误解决办法

博主头像站长评测
发布于 2020/01/05(修订于 2023/07/11)原创独立站体系

Rank Math是笔者现在使用的SEO插件,自带了sitemap站点地图的功能,今天在给一个客户配置的时候发现index_sitemap.xml访问提示404错误。记录一下解决办法。

出现这个问题通常都是伪静态没有配置好导致的,只需要把下面的规则添加到虚拟主机的配置文件里面就可以了。

Nginx的配置如下:

# 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

Apache的配置如下:

# 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

同样的问题: