Page 1 of 1

password protect a single link

Posted: Wed Mar 25, 2009 4:37 am
by clarance
Hey,

I have played around with different ways of password protecting a video file from a link and I come up empty. the only way I can think of is to have it on a separate page, where that page is password protected?!!!

If anyone know and can help with an attempt to password protect a single link it would be very much appreciated. It doesn't necessarily have to be in php if other methods are there I am all ears.

Thanks

BC

Re: password protect a single link

Posted: Wed Mar 25, 2009 7:11 am
by Apollo
Put a .htaccess file in the same dir as your movie, with this content:

Code: Select all

<files "yourmovie.mkv">
AuthUserFile /some/nonpublic/folder/.htpasswd
AuthName "Sorry, 18+ only!"
AuthType Basic
require valid-user
</files>
And /some/nonpublic/folder/.htpasswd sould be a text file with this line:

Code: Select all

UserName:PasswordHash
where PasswordHash is password, hashed with PHP's crypt function. You can also create a hash online, for example here.

Re: password protect a single link

Posted: Wed Mar 25, 2009 10:07 am
by clarance
can I do it for all the movies in that directory and not just one?

Re: password protect a single link

Posted: Thu Mar 26, 2009 1:17 pm
by clarance
Thank you for pointing me in the right direction Apollo.

I ended up going with

<MatchFiles>

BC