Is it possible to detect source of web forwarding?
For example,
Domain A
redirects to Domain B
where Domain B has PHP hosting?
Basically I would like something like the following:
if ($was_redirected_from_domain_a) { ... }
Is it possible to detect source of web forwarding?
For example,
Domain A
redirects to Domain B
where Domain B has PHP hosting?
Basically I would like something like the following:
if ($was_redirected_from_domain_a) { ... }
As @MoarCodePlz and @Christopher Armstrong point out, $_SERVER["HTTP_REFERER"]
is the solution.
However, in your specific case, two redirects take place:
http://fhc.quickmediasolutions.com/image/-1457172086.png
This way, the original referrer info is lost. You will need to disable the second redirect, and run your PHP in my-art-gallery.co.uk
's index page.
Update after seeing the phpinfo()
output:
$_SERVER["HTTP_REFER"]
is indeed completely non-existent.
I suspect the culprit is this configuration setting:
suhosin.server.strip = On
your hosting company is running the Suhosin PHP patch, which allows removing certain data from the PHP page for enhanced security. You may need to ask them to activate HTTP_REFERER.
The only other way would be redirecting domain A to something like
domainb.co.uk/index.php?camefrom=domainA
You could then fetch the domainA argument through $_GET["camefrom"]
- if the hosting provider's control panel allows that sort of redirection.