PDA

View Full Version : Hotlink Help



MBCassie
July 16th, 2005, 18:46
I'm not sure if this is the right forum...

I have this file, it's a video on my website. I just found out that someone from another site is directly linking to that video and letting people stream it (they have a little video thing on their site).. and it's killing my bandwith (I don't even let people on my site stream it.. I ask that they download it)

So, is there any way to protect just one file from being hotlinked?

Thanks.

killaH
July 22nd, 2005, 20:27
Does your server have cPanel? In that case, there are some options built into cPanel to prevent this.

borgx
July 24th, 2005, 05:44
Seeings how you didnt give any information on what httpd your host is using, try http://www.google.com/search?hl=en&q=hotlink+protection&btnG=Google+Search

By guessing its apache; as any normal host has, that your hosted on. You can try a .htaccess mod_rewrite solution or like killaH said if you have cPanel its very easy to enable hotlink protection.

mod_rewrite solution in a .htaccess file (it will only work for the directory and sub-directorys the .htaccess file is in, this is just about the same code cPanel uses)

For a 403 Forbidden page to be displayed use
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com.*$ [NC]
RewriteRule .*filename\.extention$ - [F]

For an image to be displayed use
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com.*$ [NC]
RewriteRule .*filename\.extention$ image/path/image.extention [L]


If you use the second piece of code, its been said to take more bandwidth.
That should get you off on the right path. Read up on mod_rewrite it has some useful functions.

Hostguide101.com
July 24th, 2005, 19:15
If your does have cpanel log into it. theres a option there that allows you to prevent hot linking and its called HotLink Protection click on this it gives you this feature


HotLink protection prevents other websites from directly linking to files (as specified below) on your website. Other sites will still be able to link to any file type that you don't specify below (ie. html files). An example of hotlinking would be using a <img> tag to display an image from your site from somewhere else on the net. The end result is that the other site is stealing your bandwidth. You should ensure that all sites that you wish to allow direct links from are in the list below. This system attempts add all sites it knows you own to the list, however you may need to add others.

hope this helpz