I have a page on my website and I want it to be accessible only by people who visit it from a certain referring site.
Let’s say my page is this:
And the referring site is this:
I want my page to be accessible only by visitors coming from the allowed site. Is there a way to do this with PHP?
The first thing I would do is put a dummy page up with the following
<?php var_dump($_SERVER); ?>
Then navigate to that page from allowedsite.com
You will see the variables that were developed with this request on the page (better formatted if you do a view source)
I believe there is a HTTP_REFERER_URL variable inside $_SERVER, but it has been my past experience that the field isn’t always populated.