This is a discussion on Parsing Current Server Domain within the PHP General forums, part of the PHP Programming Forums category; Does anyone know how I would parse the domain that scripts are currently being executed in? For example: I use ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Does anyone know how I would parse the domain that scripts are currently being executed in?
For example: I use seperate domains for development and production. There are times I have to specify a hard coded url instead of a relative one. So for the development it would be; dev.domain.com/somefile.php where on the live site it would be www.domain.com/somefile.php I would like the script to be able to parse the domain part so it would be; $currentdomain/somefile.php AAny suggestions would be greatly appreciated. Jeff Pearson |
|
|||
|
* Thus wrote jeffrey pearson (jpearson@usc.edu):
> Does anyone know how I would parse the domain that scripts are currently being executed in? > > ... > > dev.domain.com/somefile.php > > where on the live site it would be > > www.domain.com/somefile.php In most cases $_SERVER['HTTP_HOST'] is what you want. It wont be available if you access the site with the ip address. Curt -- "I used to think I was indecisive, but now I'm not so sure." |