How to disable direct url unless linked from another page?

322 views Asked by At

I have a page called snow.php. I want to disable people from being able to see my webpage if they type in www.mysite.com/snow.php unless they are linked from another page. So if I have another page called about.php and link to snow.php they'll be able to see it.

2

There are 2 answers

3
AlexL On

What you want is how to prevent hotlinking. Here is a small tutorial: http://www.hongkiat.com/blog/smarter-way-to-prevent-image-hotlinking-with-htaccess/

3
bdarrow1021 On

This method isn't 100% reliable, but you can use $HTTP_SERVER_VARS['HTTP_REFERER'] to get the current page that the user came from to access snow.php.