[development] Loading configuration using 'SERVER_NAME' as opposed to 'HTTP_HOST'

Cog Rusty cog.rusty at gmail.com
Sun Mar 15 20:41:03 UTC 2009

On Sun, Mar 15, 2009 at 8:42 PM, Adam Cooper <adam.j.cooper at gmail.com> wrote:
> Hello all,
> It's a (very) long time since I posted to this list. So please excuse me if
> I'm breaking etiquette. I'm attempting to set up a development environment
> that suits my way of working. Using a VMware virtual machine (that is as
> close a replica to my VPS as possible) I've set up an apache instance and am
> adding virtual hosts to it as I go. Up until now I've had no issue bring
> across my current sites. They all are single sites and so have been set up
> in the 'default' configuration. I can add an entry to my host machines hosts
> file (say 'sitename.dev') and everything works great.
> The problem now is that I have come across one of my multisite
> configurations. I figured I could just set the virtual host configuration to
> have ServerName as my site name (sitename) and then ServerAlias in the name
> I would be accessing it as (sitename.dev). Setting UseCanonicalName to 'on'
> would let me access the site as I would expect.
> Except, despite this setting SERVER_NAME to the value I expect (sitename) my
> drupal configuration refuses to load. I took a look in the bootstrap file
> and found that the configuration directory is loaded from HTTP_HOST.
> TL;DR.
> So my question is this, why does drupal load it's configuration using
> HTTP_HOST as opposed to SERVER_NAME? Surely SERVER_NAME would allow more
> flexibility and more direct control? Would a patch changing this have any
> chance of being looked at?

Generally, for Drupal multisites to work under different Apache
configurations, Drupal needs to rely more on the client's HTTP request
rather than the server configuration. You can see a related issue in

> Thanks
> Adam

More information about the development mailing list