GoogleSitemap not displaying HTTPS in the XML results, just HTTP


GoogleSitemap not displaying HTTPS in the XML results. It is showing the old url ie with HTTP, rather than HTTPS - I don’t know if this is effecting Google but I would like to fix. Thanks, David


MODX version 3.03 GoogleSitemap version 2.13

There is a similar issue on (the old) Github repository.
You could try to force https by changing full to https in this line of code:

But if you request the site that runs the “GoogleSiteMap” snippet with https, this shouldn’t be necessary.

I think that code is from the first version of GoogleSiteMap - I’ve looked through the code in version 2 but can’t figure out what to change.

Depending on how you call the “GoogleSiteMap” snippet, it might still be the version 1 code that gets executed.

In the version 2 code, the value for the site url is read from the system/context setting site_url and output in a <loc> tag:

If there is no context setting site_url and no explicit site_url system setting, the MODX core code extract the value from the current request ($_SERVER['HTTPS'], $_SERVER['HTTP_HOST']) in the file core/config/

Meaning, if you call your site with http:// then the site_url setting will contain http://, if you call it with https:// the setting will contain https://.

Found a solution hidden away in the System Settings - link_tag_scheme

For https this should be set to 1 - it was on -1

And boom the sitemap.xml is giving me the HTTPS

Double check all links and everything is working as should.

Many thanks !

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.