views:

25

answers:

2

Is it possible to track which links redirected to my site? For example if it's a short URL http://alturl.com/6rp7w that redirects to http://www.mysite.com would I be able to track http://alturl.com/6rp7w?

+1  A: 

It depends on whether or not that is the URL passed as the referrer. If you have a public site you can test with, set up a small url and point it to a test php page and put this:

<?php
  echo getenv("HTTP_REFERER"); 
?> 

If the URL is the same, then the referring URL is passing the small URL and you can track it. If the referrer shows up as http://alturl.com... then chances are you will not be able to track the actual URL.

cdburgess
Yes that echos the page with the link but not something like `http://alturl.com/ta6s9` I guess there's no way to do it?
Cyber Junkie
Correct. You can only get what the referring server is sending. So if they are not sending anything else, then you cannot retrieve that information when it sends a referrer. The upside is, typically these URL shortening things will use the same URL. So if you know the page they are hitting, you can do a reverse lookup so know which link it came in from (but that is out of scope for this question).
cdburgess
reverse lookout. Thanks! I do some research on that!
Cyber Junkie
+1  A: 

Using the $_SERVER['HTTP_REFERER'] variable is going to be the closest thing you'll get.

Joe Philllips
Thanks but I need to find out the link instead of the site the link was posted on
Cyber Junkie