与自定义永久链接一起使用时出现 Wordpress 站点地图 XML 错误


Wordpress Sitemap XML Error while using with Custom Permalinks

我在wordpress上开发了一个网站,在那里我使用Yoast SEO插件(https://wordpress.org/plugins/wordpress-seo/)进行SEO和自定义永久链接(https://wordpress.org/plugins/custom-permalinks/)来自定义我的链接。

现在的问题是 Yoast SEO 和谷歌站点地图都无法在我的网站上生成站点地图 XML,它返回 404 错误。如果我禁用自定义永久链接插件,那么它可以完美运行。

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

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

问候

马诺伊·索尼

如果您

使用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=$1&sitemap_n=$2 [L]
RewriteRule ^([a-z]+)?-?sitemap.xsl$ /index.php?xsl=$1 [L]
# END Yoast SEO - XML Sitemap Rewrite Fix