Wordpress 站点地图 XML 使用自定义永久链接时出错

Wordpress Sitemap XML Error while using with Custom Permalinks

我在 wordpress 上开发了一个网站,我在其中使用了 Yoast SEO 插件 (https://wordpress.org/plugins/wordpress-seo/) for SEO and Custom Permalinks (https://wordpress.org/plugins/custom-permalinks/) 来自定义我的链接。

现在的问题是 Yoast SEO 和 Google Sitemap 都无法在我的网站上生成站点地图 XML,它 returns 404 错误。如果我禁用 Custom Permalinks 插件,那么它会完美运行。

我什至尝试将我的 Yoast SEO 插件更改为多合一 SEO,但问题仍然存在,站点地图仅在自定义永久链接被禁用时才有效,我不能这样做,因为我创建了自定义 post 类型并且我必须使用它。

有没有人使用这个组合并解决了这样的问题?

此致

马诺杰·索尼

如果您使用 Yoast SEO 插件,他们会在他们的网站上显示如何修复它 - http://kb.yoast.com/article/77-my-sitemap-index-is-giving-a-404-error-what-should-i-do

在 Apache 服务器上,但请确保将其放在 .htacess 中的 WordPress 代码之前。

# Yoast SEO - XML Sitemap Rewrite Fix
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap_index.xml$ /index.php?sitemap=1 [L]
RewriteRule ^locations.kml$ /index.php?sitemap=wpseo_local_kml [L]
RewriteRule ^geo_sitemap.xml$ /index.php?sitemap=geo [L]
RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?      sitemap=&sitemap_n= [L]
RewriteRule ^([a-z]+)?-?sitemap.xsl$ /index.php?xsl= [L]
# END Yoast SEO - XML Sitemap Rewrite Fix