I've got traffic being 302'd to my site. All I get to see is the original page the click started at.
Is there a way (java/php) to read the URl of the 302?
URl 1: http://www.example.com/folder/page.php
a href links to
URl 2: http://www.othersite.com/redirect.php
which 302 redirects to
URl 3: http://www.mysite.com/
I only know how to find out what URl 1 is using coding on my own site (http referer). How do I find out what URl 2 is? Currently, nothing I do tells me.
7:26 pm on May 4, 2013 (gmt 0)
Double-check: Do sites 1 and 2 belong to you? The question seems to imply they don't-- except in that case how would you know it's a 302 rather than a 301?
Are you looking for an answer that's constrained to information available at mysite.com, regardless of whether you have access to the first two?
11:16 am on May 6, 2013 (gmt 0)
That's right, I don't own URl 1 or 2.
I can only use mysite.com to determine where traffic is coming from.
1:01 pm on May 6, 2013 (gmt 0)
9:29 pm on May 6, 2013 (gmt 0)
The underlying problem is that all the servers involved are doing exactly what servers are supposed to do: retain the original referer when a request is redirected along the way.
How many different redirects are involved? If it's only a few and you just need the information once, it may be simpler to borrow your brother's computer, go to the originally referring URL and see what they link to. Not too useful of course if it's a directory with hundreds of links.
That's assuming you're talking about an ordinary redirect, rather than a proxy. If it is a proxy, you may get some useful information from the "X-Forwarded-For" header. It won't come through in logs but you can pick it up via php. Or, if you simply want them to stay the ### away, you can use mod_rewrite or mod_setenvif (or, er, equivalent in That Other Server) to check the header and take action.