Get HTTP Referrer on Redirection

馋奶兔 提交于 2019-12-01 17:13:49

How can you get the HTTP Referrer when redirected from another website

You can't. If the redirection takes place under your control, you can add the original referer as a parameter, but if the external redirector doesn't do that, you have no way to get hold of the information.

An example of how I did it. Say we have 3 pages, one calling the next.

page1.com -> page2.com -> page3.com.

in page2.com get the page1.com using:

$referrer = $_SERVER['HTTP_REFERER'];//=page1.com

when redirecting to page3, send $referrer as a GET parameter

page3.com?referrer=$referrer

in page3 read the $referrer from the get.

$initialReferrer = $_GET['referrer'];//=page1.com
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!