Forum Moderators: coopster

Message Too Old, No Replies

Using Domain Name as variable (Virtual Server

Need to see which domain name is being used and show different content

         

jbalestrieri

4:58 pm on Oct 30, 2003 (gmt 0)

10+ Year Member



I have a client who has three domain names, all pointing to the same Virtual Web Server.
I need to be able to read the domain name (www.domain1.com) and change one element on the template to reflect that it is the different domain name.
So in a simple example

www.domain1.com – welcome to domain1.com
www.domain2.com – welcome to domain2.com
www.domain2.net – welcome to domain2.net

I know I have to use the parse_url, but being a newbie I have no clue on how I am to use this effectively.

Any help out there?

bakedjake

5:00 pm on Oct 30, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Welcome to WebmasterWorld jbalestrieri!

There's a TON of great material in the PHP manual for this fuction:

[us3.php.net...]

jatar_k

5:28 pm on Oct 30, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld jbalestrieri,

always more than one way to skin a cat

$sitename = $_SERVER['HTTP_HOST'];
$sitename = str_replace("www.","",$sitename);
echo "welcome to $sitename";

Server variables: $_SERVER [ca.php.net]

jbalestrieri

5:38 pm on Oct 30, 2003 (gmt 0)

10+ Year Member



Thanks jatar_k
Worked much better and easier then the route I was going.