我设法向Yoast插件添加了外部站点地图,并且工作正常,但我需要将以下代码合并为一个简单代码( .htaccess文件)
RewriteRule ^\/?product-sitemap1\.xml$ /ext-sitemap/product-sitemap1.xml [L]
RewriteRule ^\/?product-sitemap2\.xml$ /ext-sitemap/product-sitemap2.xml [L]
RewriteRule ^\/?product-sitemap3\.xml$ /ext-sitemap/product-sitemap3.xml [L]
RewriteRule ^\/?product-sitemap4\.xml$ /ext-sitemap/product-sitemap4.xml [L]
RewriteRule ^\/?product-sitemap5\.xml$ /ext-sitemap/product-sitemap5.xml [L]
RewriteRule ^\/?product-sitemap6\.xml$ /ext-sitemap/product-sitemap6.xml [L]
function.php文件
add_filter('wpseo_enable_xml_sitemap_transient_caching', '__return_false'); add_filter('wpseo_sitemap_index', 'add_sitemap_custom_items');函数add_sitemap_custom_items(){
$ sitemap_custom_items =' https://example.com/product-sitemap1.xml 2019-01-18T00:12:27 + 00:00';$ sitemap_custom_items。=' https://example.com/product-sitemap2.xml 2019-01-18T00:12:27 + 00:00';
$ sitemap_custom_items。=' https://example.com/product-sitemap3.xml 2019-01-18T00:12:27 + 00:00';
$ sitemap_custom_items。=' https://example.com/product-sitemap4.xml 2019-01-18T00:12:27 + 00:00';
$ sitemap_custom_items。=' https://example.com/product-sitemap5.xml 2019-01-18T00:12:27 + 00:00';
$ sitemap_custom_items。=' https://example.com/product-sitemap6.xml 2019-01-18T00:12:27 + 00:00';
返回$ sitemap_custom_items; }