Click to See Complete Forum and Search --> : Web Page Protection


dcjones
08-01-2003, 10:15 AM
Hi all,

Question. I can protect a directory on my web site useing .htaccess but can I protect the same directory but only allow access which comes form a fixed URL without the server asking for the login ID and password.

Does this make any sense, I hope so.

Can anyone advise please

Thanks in advance

Keep safe and well

Dereck

dcjones
08-02-2003, 04:18 PM
Can anyone help with this post

Many thanks

Dereck

PeOfEo
08-03-2003, 01:57 PM
Yes you can. I would not know how to do it with a client side script (It would also not be secure, a user can view your source to get the url) But with a server side languge it is possible. In asp.net it would look like this

if request.ServerVariables("HTTP_REFERER") <> "theurlyouwant" then
response.Redirect("anotherpage")
end if

dcjones
08-03-2003, 04:11 PM
PeOfEo

Thanks for your reply. I will have a look at implementing
your reply useing php.

Thanks

Keep safe and well

Regards

dereck

pyro
08-03-2003, 04:21 PM
<?PHP
if ($_SERVER["HTTP_REFERER"] == "http://www.yourdoamin.com/somepage.php") {
header("Location:http://www.php.net");
}
?>Must be set before any code is sent to the browser, including <html> etc...

dcjones
08-03-2003, 05:52 PM
pyro

Thanks for that, you are a star.

Keep safe and well

Regards

dereck

pyro
08-03-2003, 06:20 PM
You're welcome... :)