homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Read a 302 Referer - is it possible?

 5:01 pm on May 4, 2013 (gmt 0)

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)

As it is the server receiving the request, unless you running JavaScript server side, this is the wrong forum. In PHP (say) you should be able to see all headers, maybe there is something useful there, I do not know.


 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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved