Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to retrieve the page URL in PHP?

1 view
Skip to first unread message

Ben Holness

unread,
Mar 30, 2002, 6:51:12 AM3/30/02
to
Hi all,

Please could someone tell me where the URL of a particular page is stored so
that I can access it from PHP?

For example, I want to create a generic index.php that prints the URL that
you typed in to get there. If you type "www.mysite.com" in the browser, you
get a page that says "welcome to www.mysite.com".

Cheers,

Ben


Jey Biddulph

unread,
Mar 30, 2002, 9:00:50 AM3/30/02
to
"Ben Holness" <use...@bens-house.org.uk> wrote in message
news:ms748a...@firewall.bensdomain...

$HTTP_SERVER_VARS["HTTP_HOST"] should hold the domain name variable ie.
www.bla.com
If you want the path to the file as well, then append it with $PHP_SELF
which holds '/folderbla/bla.php'

All these variables can be found in phpinfo. Load a PHP file onto your
server with

<?php
phpinfo();
?>

in it, and then run from your browser.

Hope this helps.


Erik Neves

unread,
Mar 30, 2002, 11:58:01 AM3/30/02
to
"Ben Holness" <use...@bens-house.org.uk> wrote in message news:<ms748a...@firewall.bensdomain>...

http://www.php.net/manual/en/reserved.variables.php

and take a look at 'HTTP_REFERER'

Happy coding.
E.

0 new messages