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?
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.
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).
$_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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With