code/solution to prevent hotlinking

rh71

No Lifer
Aug 28, 2001
52,844
1,049
126
I have a site with videos but I want to prevent people from directly linking to the vids' direct URLs... what's the easiest solution for this ? I know to check for the referrer but that's all I know...

The webhost runs on WIN2003 (I believe IIS) and handles PHP and ColdFusion.
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
Checking the referrer is all you can do, so far as I'm aware. Even that is only a convenience roadblock as it won't really stop anybody from getting at your content from another link.
 

rh71

No Lifer
Aug 28, 2001
52,844
1,049
126
^ that's really not a huge concern that they get the video from a mirror... if they want to do that, I'm not going to do anything about it.

I just want them to hit my homepage first and foremost instead of just grab the video on my host linked from another website.
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
Originally posted by: rh71
^ that's really not a huge concern that they get the video from a mirror... if they want to do that, I'm not going to do anything about it.

I just want them to hit my homepage first and foremost instead of just grab the video on my host linked from another website.
I'm not sure you're using the term mirror correctly there (or I'm just really confused). Mirrors have nothing to do with people linking to your site.

But a good idea there. If they request a video, check the referrer. If it's from your site, give them the file. If not, redirect them to your page which has a link to the video. That's probably more convenient for them than faking a referrer or copying and pasting in a url to have no referrer.
 

stndn

Golden Member
Mar 10, 2001
1,886
0
0
this article might be a little old, but i think it will give you a good start on how to prevent hotlinking to some extend.

it talks about images, but you can easily modify them to prevent video hotlinking.