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
同样的问题:
コメントは閉鎖されました
この記事のコメント機能は閉鎖されています。ご質問がある場合は、他の方法でお問い合わせください。