is there any PHP code i could use to find out what is the exact url that the user has reached the site by.
like return respectively "http://mysite.com/blah.php". i hope i have explained myself well. thanks in advance.
(i'd like to use this to have 2 domains parked on one webhost, like site1.com and site2.com have the same webhost/files but the code would figure out if youve visited the site by going to site1.com or site2.com so it would display the correct site)
current URL?
Moderator: General Moderators
thanks, i found it just as you posted it to in the manual. has anyone else used a method like this to host 2 domains on one webservermarkl999 wrote:$_SERVER['HTTP_HOST']; with
$_SERVER['PHP_SELF'] or $_SERVER['REQUEST_URI'];
If you do a var_dump($_SERVER); you'll see the elements you can use to build up the current, full, url.
I use on sites such as dev.foo.com, beta.foo.com, alpha.foo.com etc.has anyone else used a method like this to host 2 domains on one webserver
I use :
define ('SITE', substr($_SERVER['HTTP_HOST'], 0, strpos($_SERVER['HTTP_HOST'], '.')));
And SITE will be either dev, beta, alpha etc.. then i use that to get site specific configuration vars.