how can I change yoast seo generated sitemap file URL?

Ad

I have a wordpress website with yoast seo plugin installed. currently the sitemap url is www.domain.com/sitemap_index.xml. As far as I know from my search results on Internet, yoast plugin itself doesn't have such option/feature for changing generated sitemap url, how can I change this url to a customized one programmatically?

Ad

Answer

Ad

Go to:

plugins/wordpress-seo/inc/sitemaps/class-sitemaps-router.php

Change line 34 to:

add_rewrite_rule( 'your_name_here\.xml$', 'index.php?sitemap=1', 'top' );

Inside Yoast Dashboard (admin.php?page=wpseo_dashboard) click on 'Save Changes'

Ad
source: stackoverflow.com
Ad