View Full Version : Hotlink protection
druhix
03-30-2002, 01:36 AM
Does anyone know the htaccess code to block hotlinking? <img border="0" alt="[Help]" title="" src="graemlins/help.gif" /> <br />I've used some other but the mother fucker redirected any visit with a refer <img border="0" title="" alt="[Mad]" src="mad.gif" />
</font><blockquote><font size="1" face="Verdana, Arial">quote:</font><hr /><font size="2" face="Verdana, Arial">I've used some other but the mother fucker redirected any visit with a refer<br /></font><hr /></blockquote><font size="2" face="Verdana, Arial">How?<br /> <img border="0" alt="[Sleeping]" title="" src="graemlins/sleeping.gif" />
LiveDose
03-30-2002, 03:05 AM
Yes, explain. Don't quite understand what you mean he redirected. He's the one hotlinking, right?
SexySites
03-30-2002, 07:32 AM
its easy to fake a referrering document any cgi language can do it.<br />laters,<br />Chris
Beaver
03-30-2002, 02:34 PM
disable hot linking of images on your site. Simply add the below code to your .htaccess<br /><br />RewriteEngine on<br />RewriteCond %{HTTP_REFERER} !^$<br />RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]<br />RewriteRule \.(gif|jpg)$ - [F]<br /><br />The above code causes a broken image to be displayed when its hot linked. <br />you can set things up so an alternate image is displayed in place of the hot linked one. The code for this is:<br /><br />RewriteEngine on<br />RewriteCond %{HTTP_REFERER} !^$<br />RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]<br />RewriteRule \.(gif|jpg)$ <a href="http://www.mydomain.com/nasty.gif" target="_blank">http://www.mydomain.com/nasty.gif</a> [R,L]<br />Same deal- replace mydomain.com with your own, plus nasty.gif
Dreamer
03-30-2002, 03:36 PM
Can somebody post .htaccess which will redirect traffic from certain domains and IP's visiting my site?<br />They aren't hotlinking pics, but he is sending about 10k surfers directly to my movie download page so I would like to redirect them to more profitable place <img border="0" title="" alt="[Big Grin]" src="biggrin.gif" />
Easy_Rider
04-03-2002, 05:49 AM
</font><blockquote><font size="1" face="Verdana, Arial">quote:</font><hr /><font size="2" face="Verdana, Arial">Originally posted by Beaver:<br /><strong>disable hot linking of images on your site. Simply add the below code to your .htaccess<br /><br />RewriteEngine on<br />RewriteCond %{HTTP_REFERER} !^$<br />RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]<br />RewriteRule \.(gif|jpg)$ - [F]<br /></strong></font><hr /></blockquote><font size="2" face="Verdana, Arial">It is good if you wanna protect one domain. But how to protect a few domains at once ??<br />Can you help ?
SexySites
04-03-2002, 09:35 AM
</font><blockquote><font size="1" face="Verdana, Arial">quote:</font><hr /><font size="2" face="Verdana, Arial">Originally posted by Easy_Rider:<br /><strong> </font><blockquote><font size="1" face="Verdana, Arial">quote:</font><hr /><font size="2" face="Verdana, Arial">Originally posted by Beaver:<br /><strong>disable hot linking of images on your site. Simply add the below code to your .htaccess<br /><br />RewriteEngine on<br />RewriteCond %{HTTP_REFERER} !^$<br />RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]<br />RewriteRule \.(gif|jpg)$ - [F]<br /></strong></font><hr /></blockquote><font size="2" face="Verdana, Arial">It is good if you wanna protect one domain. But how to protect a few domains at once ??<br />Can you help ?</strong></font><hr /></blockquote><font size="2" face="Verdana, Arial">hmm try messing around with the access.conf in your apache configuration? im sure there is way you can set it for the whole server; otherwise you know what you'll have to do ..but setting up a simple script would be fairly easy and functional.<br /><br />laters,<br />Chris
SexySites
04-03-2002, 09:41 AM
get it from the horses mouth <img border="0" title="" alt="[Big Grin]" src="biggrin.gif" /> <br /><br /><a href="http://httpd.apache.org/docs/misc/rewriteguide.html" target="_blank">http://httpd.apache.org/docs/misc/rewriteguide.html</a><br /><br />laters,<br />Chris
Easy_Rider
04-15-2002, 05:56 AM
OK pals,<br />After many tries I found the best anty hotlinking .htaccess code, which protect your all domains, subdomains and all type of files exempt .html <img border="0" title="" alt="[Smile]" src="smile.gif" /> <br /><br />Here u are:<br /><br />RewriteEngine on<br />RewriteCond %{HTTP_REFERER} !^$ [NC]<br />RewriteCond %{HTTP_REFERER} !^http://.*\.domain1\.com.*$ [NC]<br />RewriteCond %{HTTP_REFERER} !^http://.*\.domain2\.com.*$ [NC]<br />RewriteCond %{HTTP_REFERER} !^http://.*\.domain156\.com.*$ [NC]<br />RewriteRule !((\.[hH][tT][mM])$|(\.[hH][tT][mM][lL])$|(/$)|(/[^.]*$)) <a href="http://www.yourdomain.com/deny1.gif" target="_blank">http://www.yourdomain.com/deny1.gif</a>
vBulletin® v3.7.3, Copyright ©2000-2012, Jelsoft Enterprises Ltd.