Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what domain am I on?

Status
Not open for further replies.

KryptoS

Programmer
Feb 7, 2001
240
BE
Hey,

I have 2 domainnames but they refer to the same site.
xxx.be and xxx.com. Now I want to know on what domain I'm.
if I'm on .be I have to go to page x, if I'm on .com I have to go to page y...

thanks

The One And Only KryptoS
 
$PHP_SELF gives you the url of the current page. You could then parse it apart.
 
i don't think either of Miros' suggestions will give you directly the answer that you are looking for.

$_SERVER['PHP_SELF'] just stores the filename of the active script.

i suspect you will be looking for the value stored in $_SERVER['SERVER_NAME'] which will give you the virtual host (or host) under which you are operating.

similarly $_SERVER['HTTP_HOST'] will contain the hostname that was actually requested by the user.

have a look in for (at least some of ) the values populated in $_SERVER superglobal.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top