Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get HTTP Referrer on Redirection

How can you get the HTTP Referrer when redirected from another website, not when they click on a link since it would work for $_SERVER['HTTP_REFERER'], but it doesn't work when a user has been redirected a website and the referrer would be empty.

What will be the method to get the referrer?

like image 521
MacMac Avatar asked Oct 28 '10 13:10

MacMac


People also ask

How do I get HTTP referer?

To check the Referer in action go to Inspect Element -> Network check the request header for Referer like below. Referer header is highlighted. Supported Browsers: The browsers are compatible with HTTP header Referer are listed below: Google Chrome.

Does 301 set Referer?

A server side 301 redirect will generally always keep the original referrer and hence will be a referral from another URL but we advise your technical team to test this redirect, please see which referring URL is being passed by inspecting the HTTP headers (e.g. using Firebug).

What is $_ server [' HTTP_REFERER ']?

$_SERVER['HTTP_REFERER'] Returns the complete URL of the current page (not reliable because not all user-agents support it) $_SERVER['HTTPS'] Is the script queried through a secure HTTP protocol.

How do I redirect without a referrer?

You will need to redirect through another page. You can do a POST to your own page which then does a redirect to the destination. This will show only your intermediate page as the referrer.


1 Answers

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.

like image 161
Pekka Avatar answered Oct 16 '22 16:10

Pekka