tags:

views:

43

answers:

2

I need to echo out some specific php code only on the sub-domain of a site. This is where I am so far.

<?php
    if($_SERVER['SERVER_NAME'] != "http://support.demo.com")
        echo "<?php bb_head(); ?>";
?>

Of course if this worked I'd not be asking a question. Help is appreciated.

+1  A: 

Host header in HTTP request is your friend here. It can be accessed through $_SERVER['HTTP_HOST']:

if ($_SERVER['HTTP_HOST'] != 'support.demo.com') {
     ...
}

Documented here.

jholster
Thanks. I was on the documentation page and just missed something obviously.
curtismchale
A: 

Yaggo was mostly correct except that you want == instead of != if you want to echo if it matches the submdomain

wag2639