• Home
  • Get help
  • Ask a question
Last post 39 min ago
Posts last week 81
Average response time last week 44 min
All time posts 70355
All time tickets 10859
All time avg. posts per day 20

Helpdesk is open from Monday through Friday CET

Please create an (free) account to post any question in the support area.
Please check the development versions area. Look at the changelog, maybe your specific problem has been resolved already!
All tickets are private and they cannot be viewed by anyone. We have made public only a few tickets that we found helpful, after removing private information from them.

#8348 – Change the name of the sitemap url

Posted in ‘4SEO’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Tuesday, 30 November 2021 11:52 UTC
coolcatcreations

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

Tuesday, 30 November 2021 12:56 UTC
wb_weeblr

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

 

 

 

 

 

 

 

 
Friday, 31 December 2021 05:34 UTC
system
This ticket has been automatically closed. All tickets which have been inactive for a long time are automatically closed. If you believe that this ticket was closed in error, please contact us.
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.