Access file only through specific website?

Turkish

Lifer
May 26, 2003
15,547
1
81
I have an html file which I want to close to public access and make it available only through clicking on a link on another specific page.

So for example:

Page in question: *****/1.html or php

I want to make sure people cannot just type in the address for it and view it but rather I want them to go to *****/2.html and click on <a href="*****/1.html>Click</a> to view it.

I guess I could do prohibit hotlinking but what I am looking for is to disable viewing the page by typing the URL on address bar.

Is this possible? Thanks :)
 

Turkish

Lifer
May 26, 2003
15,547
1
81
I tried this but get a parse error on line 7.

<?php
define('ALLOWED_REFERRER', 'allowed referrer url');

if (ALLOWED_REFERRER !== ''
&& (!isset($_SERVER['HTTP_REFERER']) || strpos(strtoupper($_SERVER['HTTP_REFERER']),strtoupper(ALLOWED_REFERRER)) === false)
) {
die("Internal server error. Please contact system administrator.");
}

//rest of the code
?>

Any ideas?

edit: nevermind, got it.