Skip to content
二哥的秘密小站

时间漂流船

二哥的秘密小站

时间漂流船

WordPress Yoast SEO Sitemaps显示404的解决办法

Posted on 2023年2月24日

在宝塔网站NGINX配置中,在server{}中添加以下代码,即可解决问题

 

#Yoast SEO Sitemaps

location ~ ([^/]*)sitemap(.*).x(m|s)l$ {

## this rewrites sitemap.xml to /sitemap_index.xml

rewrite ^/sitemap.xml$ /sitemap_index.xml permanent;

## this makes the XML sitemaps work

rewrite ^/([a-z]+)?-?sitemap.xsl$ /index.php?yoast-sitemap-xsl=$1 last;

rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;

rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;

}

未分类

文章导航

Previous post
Next post

Search

Archives

  • 2025 年 7 月
  • 2025 年 6 月
  • 2025 年 1 月
  • 2024 年 12 月
  • 2024 年 3 月
  • 2024 年 2 月
  • 2023 年 12 月
  • 2023 年 9 月
  • 2023 年 8 月
  • 2023 年 7 月
  • 2023 年 6 月
  • 2023 年 5 月
  • 2023 年 4 月
  • 2023 年 2 月
  • 2022 年 12 月
  • 2022 年 10 月
  • 2022 年 8 月
  • 2022 年 7 月
  • 2022 年 6 月
  • 2022 年 2 月

其他操作

  • 注册
  • 登录
  • 条目 feed
  • 评论 feed
  • WordPress.org
©2025 二哥的秘密小站 | WordPress Theme by SuperbThemes