How does Drupal select default domain for relative links? In one of our Drupal sites (core 7.14) links in two blocks displayed on the front page recently started using one of the alternate domains defined in the Apache config for the site instead of the primary domain. Neither block was changed recently. There are other blocks on the front page, and throughout the site, that were not affected.

The links in the block were of the style href="node/123" (without a leading slash). After investigating any modules or settings that seemed related to blocks or links, we added a leading slash to the links (i.e. href="/node/123") just to see if that had any effect. It did. The links using a leading slash selected the primary domain while the ones without a leading slash choose one of the alternate domains.

Any links in the block without a leading slash used the same alternate domain, so Drupal wasn't randomly selecting domains for each link.

The site launched using 7.10 and this odd behavior didn't start until we upgraded to 7.14. This only appeared in one site (so far); our other Drupal sites don't do this.

So my question is, how does Drupal choose the domain to use when rendering links and did that change somehow in 7.14? Does Drupal read the Apache config file?

Thanks for taking the time to read and consider my question.
You can specify the domain in settings.php - it's the variable called $base_url (around line 271). It is not always necessary, but I've found it can prevent some unexpected errors if the domain is set explicitly. I'm not sure how Drupal decides the domain if the $base_url is not set. By default, the $base_url is commented out. To set it, remove the # in front and change www.example.com to your primary domain.

Are the links in the block built using a Drupal menu? I think when you set the leading slash, you actually circumvented Drupal's menu handling which is probably why it worked. If you set the $base_url, I think you could remove the leading slashes from the links.