I just noticed that XML sitemap is presenting all of the sitemap links as "http://default/" rather than the URL listed in the "default base URL" of the advanced settings for the module.

The URLs in the sitemap actually try to take me to http://default, or the appropriate non-existent subpage.

This error seems pretty critical, so I imagine it is something I did wrong with my site. Unfortunately, I can't figure out what setting I changed to create this error.

Thank you.

Comments

Anonymous’s picture

Status: Active » Postponed (maintainer needs more info)
  • How are you executing cron?
  • What do you have set for $base_url in settings.php?
  • What is the string in the default base URL?
Illich’s picture

Responses to Earnie's questions below, but first:

I just checked into the sitemap.xml and the problem is gone! The URLs are correct.
I didn't actually do anything between posting the initial help request and checking on it, except sleep.
So the immediate problem is solved, but the cause remains unknown.

  • How are you executing cron?

Cron is set to run every three hours on the site, according to the cron configuration. I did manually run cron while trying to troubleshoot the http://default/ error prior to posting my initial help request.

  • What do you have set for $base_url in settings.php?

No base_url is set. The statement is still commented:

# $base_url = 'http://www.example.com';  // NO trailing slash!
  • What is the string in the default base URL?

http://experienceolympic.com
The sitemap that now works is at http://experienceolympic.com/sitemap.xml

Thank you.

Anonymous’s picture

Priority: Major » Normal
Status: Postponed (maintainer needs more info) » Fixed

Ok, hopefully it won't come back. It is usually a result of not having a $base_url set and the way cron is executed, i.e. the URI used to execute cron. If you used drush, IIRC, this has been a cause.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Dave the Brave’s picture

Status: Closed (fixed) » Active

I'm reopening since I am experiencing the same issue, and I also think drush cron should result in the correct domains since using drush cron as the cron executable is becoming more popular.

"How are you executing cron? "
I have attempted drush cron and manual cron, both generate 'default' as the domain.

"What do you have set for $base_url in settings.php? "
I have the site's base url set.

"What is the string in the default base URL?"
The same as $base_url sans the trailing slash.

I have tried different combinations of these as well with no luck.

TravisCarden’s picture

Title: sitemap generating "http://default/" » Prevent "http://default/" as base url in sitemaps
Version: 7.x-2.0-rc2 » 7.x-2.x-dev
Category: support » feature

If you're running cron via Drush you need to specify the URI, either manually as a command line option or via a site alias. e.g., drush cron --uri=http://whatever.com/ or drush @whatever cron.

In the end, this comes down to configuration error, but I wonder if more should be done to prevent it. It would probably be fitting to add something to the documentation about it. Perhaps the module should also test for the condition and refuse to (re-)generate a sitemap based on http://default/ as a base URL* and write an error/warning to the log.

*It's difficult to imagine a scenario, even on an intranet, where such would be the intended outcome.

Anonymous’s picture

I'm really scratching my head on this one... I've set $base_url, checked the URL in XML Sitemap settings, changed from a regex redirect in .htaccess to an explicit redirect, run via drush, run via Drupal, and run via curl, and I still get http://default/.

Only difference is Nginx vs Apache (works on Nginx), but I can't really do anything past the local .htaccess on HostGator. (Client wouldn't let me host his site.)

nickknack’s picture

Issue summary: View changes

Affiming Illich's original issue. I experienced a 24-hour lag between populating the sitemap and conversion from "http://default" to "http://site.com." Same Base URL and cron settings.

jonhattan’s picture

Status: Active » Fixed

This is because using misconfigured drush. See http://docs.drush.org/en/master/cron

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

ecvandenberg’s picture

This issue is alive and kicking again at my old Drupal 7 websites.
Refering to post #9, that link is broken.
But when I check https://drushcommands.com/drush-8x/core/core-cron/ I do not see any issue.

How to resolve this issue other than activating the automated cron?

ecvandenberg’s picture

Ah...found it.

Add a base URL in your settings.php and drush cron will generate a correct xml sitemap.