Can you really identify supply of web sending?

For instance, Domain A redirects to Domain B where Domain B has PHP hosting?

Essentially I'd like something similar to the next:

if ($was_rerouted_from_domain_a) 

As @MoarCodePlz and @Christopher Remedy explain, $_SERVER["HTTP_REFERER"] may be the solution.

However, inside your specific situation, two redirects occur:

enter image description here

By doing this, the initial referrer info is lost. You will have to disable the 2nd redirect, and run your PHP in kingdom's index page.

Update having seen the phpinfo() output:

$_SERVER["HTTP_REFER"] is definitely completely non-existent.

I suspect the reason is configuration setting:

suhosin.server.strip = On

your webhost is running the Suhosin PHP patch, which enables getting rid of certain data in the PHP page for enhanced security. You may want to request these to activate HTTP_REFERER.

The only real other way could be redirecting domain A to something similar to kingdom/index.php?camefrom=domainA

You can then fetch the domainA argument through $_GET["camefrom"] - when the hosting provider's user interface enables that kind of redirection.

What you ought to take a look at is called the url referrer from the page. The url referrer may be the url that the present user managed to get towards the site. Be cautious, though, because the url referrer is going to be nonexistent when the user opened up up a tab and just entered the url.

The url referrer should have the ability to be located while using following:


As Pekka stated, it is dependent how the consumer was submitted. Try checking the $_SERVER['http_referrer'] value:

if ($_SERVER['HTTP_REFERER'] == '')