How do i find out what URL a user entered to find my site.
Moderator: General Moderators
-
phillcahill
- Forum Newbie
- Posts: 1
- Joined: Mon Nov 07, 2005 3:41 pm
- Location: uk
How do i find out what URL a user entered to find my site.
sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
Last edited by phillcahill on Sun Jul 17, 2011 4:25 pm, edited 1 time in total.
You can try getenv('HTTP_REFERER'). I'm not sure if this can be accomplished using mod rewrite, but it would certainly be interesting.
-
vincenzobar
- Forum Commoner
- Posts: 95
- Joined: Wed Nov 02, 2005 9:57 am
heres a snippet i wrote to get referer info
good luck
Code: Select all
$_SERVER['HHTP_REFERER'];//get referring URL
$referring_url = $_SERVER['HTTP_REFERER']; //assign referring URL
//i believe if you change 'host' to 'path' you get the whole string
$parsed = (parse_url($referring_url)); //breaking this bad boy down
$uri = $parsed['host']; // calling the host from the referer URL
// echo "<BR>uri: " . $uri . ""; // testing purposes- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
reserved.variables wrote:'HTTP_REFERER'
The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
it all depends on how these domains "point" to your actual domain. If they redirect to the main domain, asside from using a URL parameter to tell your main server where they are coming from, referrer is the only way to really know... If you remain on the other domain, but are accessing the main domain (rewriting/virtual host) then you can access what the server is through $_SERVER['HTTP_HOST']