There is code posted to return the subdomain using Drupal 5, but on Drupal 6 I would like to return the subdomain.

I can use HTTP_HOST to return one.example.com, but I would like to just return the "one" only.

Any help please, I need this working before I can continue on!

Thanks

Comments

rampar’s picture

Type in:

$urlParts = explode('.', $_SERVER['HTTP_HOST']);
echo $urlParts['0'];

Using "print_r($urlParts);" will show the Array's to get the different parts.

Hope this helps someone, I looked for 4 hours easily.

mrhobbeys’s picture

Thanks I am going to try that out.

mrhobbeys’s picture

I wouldn't think you could do that unless you owned the "one".

Think about it if we could do that every scammer in the world would be able to say "ebay" or "google" or something and that would be bad. But if you own the "one" then you are looking for the same thing I am and I would very much like to know if you get it or not.

Thanks