[development] Accommodating a second base_url
Jeff Greenberg
jeff at ayendesigns.com
Thu Oct 29 23:37:35 UTC 2009
Jamie Holly wrote:
> Depending on the server setup you could just use $_SERVER['HTTP_HOST']
> to figure out your $base_url. You can even do it in settings.php. It
> does depend on if your sites use www. or not, or even allows both www.
> and not. You could use a little PHP logic in settings.php to figure
> out exactly what the HTTP_HOST should be (stripos, strstr, switch
> case, etc) and then define a constant for it (say CURRENT_SITE), then
> in your page.tpl.php file a little PHP magic:
>
> <duv id="banner" style="background-image:url(images/<?php echo (
> CURRENT_SITE=='example.com')?'site1header.jpg':'site2header.jpg'; ?>)">
>
> That way CURRENT_SITE wouldn't matter if you have www.example.com or
> example.com. Of course you would set your base_url off of which ever
> they are coming from.
>
> That would work for most server setups (I've been doing something
> similar on a pretty big site for over a year now). The only real time
> you run into problems is on some proxy front ends.
>
Jaime, so far looks like the cleanest approach I could use. Thanks.
More information about the development
mailing list