I wish to possess a 404 page that may identify if your user originates to that particular page either via my website, via my reduced URL or via another site, and i'm which makes it using PHP. I'm gradually dealing with grips with PHP which might be a simple question, however i am quite tired to tell the truth and also have no caffeine during my system, and i'm attempting to connect any loose finishes during my portfolio as quickly as possible.
I've discovered the
$_SERVER['HTTP_REFERER']; PHP variable provides me with the whole URL, the industry start. It is possible to method in which this could produce just the root domain, either via another variable or perhaps a function, considering that some referrers might be using http:// plus some https:// (so simply beginning in the seventh character wouldn't always work)? This way, I'm able to match the URL according to two (or even more) predefined addresses and convey this content that pertains to that domain.
Note though the referer is terrifically simple to spoof, therefore it is hardly reliable.
http://php.net/manual/en/function.parse-url.php might be your best choice, although you could utilize a normal expression to attain what you are searching for easily too.