Hello.

My website is accessible with http and https. With the module securelogin the user is forwarded to the secure URL when logged in.

I installed xmlsitemap and configure the Default base URL to http://example.com but all the URLs generated are https://example.com. What is this setting for then?

The URL of the generated file is https://example.com/sitemap.xml and there isn't any option to change it to http.

Best regards.

Comments

pmagunia’s picture

When my base_url was changed without www the updated site map still reflected the previous URL with the www. I had to uninstall the module completely, flush all caches, run cron and updates. After that the new base_url was reflected.

Coupon Code Swap’s picture

Just to confirm, I turned on the $base_url for a site in settings.php to default to https and had to deactivate the XML Sitemap modules, uninstall, clear cache, reactivate modules, add settings again, regenerate and then the sitemap was finally created properly with all URLs including https://

jenlampton’s picture

I'm having the problem where my base URL changes to something I don't want it to be when the sitemap is regenerated using cron. This same problem is described in all these issues:
#971486: After cron runs, sitemap.xml contains incorrect links.
#1199192: sitemap file base url changes sporadically.
#1031484: Removing port number from URL
#562404: site is exmaple.com, sitemap is www.example.com, throwing errors in other sites
#505232: Generating site URLs with IP address instead of domain name

This problem is also documented in Known Issues so I'm guessing it's not quite fixed yet :)

It sounds like the current recommended work-around is to set the base url in settings.php in spite of the fact that there is a UI for this on the module settings page (in 2.x). If that is the correct solution, then we should remove this base url setting, since it leads people to believe this value will be used in the sitemap. I, however, prefer having a this specific setting since it's easier for people to set via this UI than in the settings.php file.

I looked at the code and couldn't see a reason why sometimes the setting doesn't seem to be used. It's always used in the code! I looked for an errant variable_del (there aren't any) or perhaps an errant variable_set (there aren't any of those either). I also couldn't reproduce this error while I was testing. It's only after "fixing" the problem (re-saving the settings form and regenerating the links), then leaving it alone for some period of time, do I come back and realize that all the URLs in my sitemap have adopted the wrong base path again.

A real head-scratcher....

cozzie49’s picture

I was able to fix the issue without uninstalling the module. I just changed the default base URL from https to http, saved the settings, ran chron manually, then jumped back in and changed the default base URL back to https, saved and rebuilt the sitemap.

This probably won't work for everyone, but I'd recommend trying this and see if it works before having to uninstall.

titus1’s picture

cozzie49's (#4) solution worked for me. thank you.

Vincent_Jo’s picture

confirming solution #4

thanks

dillix’s picture

Version: 7.x-2.0 » 7.x-2.x-dev
oncreative’s picture

I have the latest version for Drupal 7 and have tried all the suggestions above and can not get the links to have https:// they always have http://

Can this be fixed soon?

Aporie’s picture

#4 worked for me.