Log in

View Full Version : how to protect single htm file from accesing from anothe site



florimi
08-21-2007, 01:32 AM
HI There.
This is my first post at dynamicdrive even I am a regular visitor.

I have an single .htm file on my site and I would like to prevent acces to that file if visitor comes from any another site except home site.
I heard that is an simple command that will prevent this.

Thankyou for any answer.

djr33
08-21-2007, 02:08 AM
Possible with .htaccess, I think, but I'm not sure exactly what that command is.

Using PHP you could check the referring page:
$_SERVER['HTTP_REFERER']

You could use an if statement and check if a certain thing exists in it, such as the root of your site (your.com), etc.