Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way in which I can find out if a user arrived at my site via a redirect?

Here's an example: There are two sites, first.com & second.com. Any request to first.com will do a 302 redirect to second.com. When the request at second.com arrives, is there anyway to know it was redirected from first.com?

Note that in this example you have no control over first.com. (In fact, it could be something bad, like kiddieporn.com.)

Also note, because it is a redirect, it will not be in the HTTP referrer header.

share|improve this question

migrated from webapps.stackexchange.com Feb 11 '11 at 23:40

This question came from our site for power users of web applications.

Google Analytics will do this for you. Are you looking to write your own JavaScript code to do this? If you are then this question should be migrated to Stack Overflow. Let me know if this is the case and I will migrate it for you. – Barry Feb 10 '11 at 8:24


  • you have no control over first.com; and
  • the 302 means the HTTP Referer header is blank; then

no, there's no way for second.com to know you're coming from a redirect.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.