Newbee question

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply

Thu Oct 24, 2002 5:33 am


Hope some one can shed some light on a small problem I have.

I want to dynamically display a logo depending on what domain is pointing at the site.

So at the moment the code is this

define('HTTP_SERVER', '');

I have tried this but it has thrown up errors.


Can this be done or have I just written the code wrong

Thanks in advance :idea:


Thu Oct 24, 2002 6:59 am

Why on earth would you want to do that???????


Thu Oct 24, 2002 7:15 am

I have several domains mirroring a virtual server.

So depending on what domain you use to access the site it will display an appropriate logo.

The site is part of a shop, so this line is defining a variable used through out the site

define('HTTP_SERVER', '');

This is why I want it to look at the domain and display etc etc etc ..........

So is this totally wrong or is their just a slight error in the code


New php-forum User
New php-forum User
Posts: 36
Joined: Thu Oct 24, 2002 10:28 am
Location: Amsterdam

Thu Oct 24, 2002 10:51 am

The variabel $_SERVER['SERVER_NAME'] refers to the servername which will be the same for each domain pointing to that server

Instead use: $_SERVER['HTTP_HOST']


should do the trick

Use the function phpinfo(); anywhere in your script to see what variables are available in your scripts and what their value is.


Thu Oct 24, 2002 1:10 pm

You can use $_SERVER['HTTP_HOST'], my point is I don't see why you want to define it as a constant, when it already exists in the Super Global Array!

Post Reply