Hi!
How can I change the sitemap URL to just sitemap.xml please?
Sometimes I am not the Person in charge for SEO Analytics and I want just to replace the old sitemap extension without needing someone else to change the url.
Thanks!
Elisa
Helpdesk is open from Monday through Friday CET
Hi!
How can I change the sitemap URL to just sitemap.xml please?
Sometimes I am not the Person in charge for SEO Analytics and I want just to replace the old sitemap extension without needing someone else to change the url.
Thanks!
Elisa
Hi Elisa,
You can't do it from the UI. It was actually changed from sitemap.xml to sitemap-4seo.xml early on because some (many) sites actually have a sitemap.xml file lying in the root folder of the site.
If that happens, then this old physical sitemap.xml file would always be loaded instead of 4SEO virtual one, the .htaccess always loads the physical one instead.
Now if you really want to change the name, you can use a filter (similar to WordPress). 4SEO (and our other extensions) use hooks a lot.
The one you can use here is for the sitemaps
configuration object.
- open/create a forseo_functions.php
file in /libraries/weeblr
- paste/adjust the content to read:
<?php /** * 4SEO hooks file * * You can use 2 variables to access 4SEO content: * * $factory: access variables * $hooks: add handlers */ // no direct access defined('WBLIB_EXEC') || die;
$hooks->add( 'forseo_config', function ($config, $scope) { if ('sitemaps' == $scope) { // example: update the sitemap exclusions list // $config['exclusions'] = array_merge( // $config['exclusions'], // [ // '/search/advanced{*}', // '/events/{*}/events', // '/events/{*}/58-guests', // '/events/date/{*}', // '/groups/{*}/37-polls', // // ... // ] // ); // example: change the sitemap main file name $config['mainFile'] = 'sitemap.xml'; } return $config; } );
After this file is saved, you should then use the Rebuild now button in the Sitemaps pages toolbar and just try to reload the sitemap in your browser, with the new URL.
NB: the "Main XML sitemap URL" displayed on that page will only be updated after you reload the page.
Using a filter, all your changes will survive 4SEO updates (there are many hooks to modify 4SEO internals).
Note that the sitemap name is advertized in the robots.txt file and also submitted directly to search engines on each update so normally you're not really concerned with the actual sitemap URL itself. Just removing the old sitemap extension should be enough - unless they listed their sitemap in your robots.txt and don't remove it on uninstall.
Best regards
Yannick Gaultier
weeblr.com / @weeblr