Never Ever Hotlink Your Files and Images

Anyway , as most of you do know. I do have tons of friends and the other day HeHeHunter (People do know him as the guy who translated Xunlei to English and stripped the ads and made it spyware free)  , was ranting about how people stripped his work and then just directly hotlink (It means that directly linking images from one’s site without permission , which is bad as it drains your bandwidth and you take no credit for it) . He did ask me for help and we thought why don’t we together and work on a script which allows webmasters to protect their files and Images. This is a great way to conserve bandwidth.

Oh No !
Oh No ! - This what happens when someone hotlinks

Oh yeah to demonstrate this purpose , here is an original article found over at HeHeHunter’s blog . Now try to visit here (i’ve hotlinked the image directly from this site). If you still see the image hit Control + F5 or just hit refresh. Now you should see the effect of it. Anyway this is the script. Oh you should check out HeHeHunter’s blog as well. He has the whole story there and how he thought a person who hotlinked his images a lesson !
To prevent people from stealing your images and linking directly (and as well as your files) , you’ll have to edit your .htaaccess. Edit your .htacesss , usaully its hidden but you can browse it if you’re using a 3rd party FTP Client that allows you edit it

#File Protect
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)? [NC]
RewriteRule \.(mp3|zip|rar)$ [NC,R,L]

#Image Protect
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)? [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ [NC,R,L]

You may want to read his entry on this and his opinon as well . Seriously , when two minds are put together to work on any project , the result is well this. No wonder processors these days comes with 2 cores and more .

4 thoughts to “Never Ever Hotlink Your Files and Images”

Leave a Reply

Your email address will not be published. Required fields are marked *