|
Posted by Justin Koivisto on 12/27/05 20:28
Trevor wrote:
> How can I get the URI for a page? For example, I want $domain =
> "http://www.domain.com" in the page http://www.domain.com/page.php.
That will depend on a bunch of different things, mostly to do with your
server setup...
Here's something to get you started (in apache):
$urI = $_SERVER['REQUEST_URI']; // includes query string...
$proto=substr($_SERVER['SERVER_PROTOCOL'],0,strpos('/',$_SERVER['SERVER_PROTOCOL']));
$port=$_SERVER['SERVER_PORT'];
$host=$_SERVER['HTTP_HOST'];
$urL = strtolower($proto).'://'.$host.':'.$port.$urI;
When in doubt, check the output of phpinfo()
--
Justin Koivisto, ZCE - justin@koivi.com
http://koivi.com
Navigation:
[Reply to this message]
|