Samurai Legend Posted March 6, 2016 Share Posted March 6, 2016 This is meant to return my domain name. However, it returns "localhost" I have not altered the code. So I don't know why this is happening. Can someone please help me out. function determine_game_urlbase() { $domain = $_SERVER['HTTP_HOST']; $turi = $_SERVER['REQUEST_URI']; $turiq = ''; for ($t = strlen($turi) - 1; $t >= 0; $t--) { if ($turi[$t] != '/') { $turiq = $turi[$t] . $turiq; } else { break; } } $turiq = '/' . $turiq; if ($turiq == '/') { $domain .= substr($turi, 0, -1); } else { $domain .= str_replace($turiq, '', $turi); } return $domain; } Quote Link to comment Share on other sites More sharing options...
Coly010 Posted March 6, 2016 Share Posted March 6, 2016 Change $domain = $_SERVER['HTTP_HOST']; to $domain = $_SERVER['SERVER_NAME']; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.