1

My website assets have been hot linked by many other websites. I doubt whether these are responsible for the downtimes on my site.

  1. How should I deal with such links?
  2. Will deleting the links solve the issue?
  3. Also, will hotlinking use up the servers entry process?
3

To stop hotlinking you can add the following to your .htaccess file. Replace example.com on line 3 with your own domain name. Also add or remove any file extensions on line 4

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)example.com/.*$ [NC]
RewriteRule \.(gif|jpg|jpeg|png|bmp|zip|rar|mp3)$ - [F]

Maybe you prefer some mischief and want to serve alternate content when hotlinking is detected.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)example.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ http://www.example.com/backside.gif [R,L]
| improve this answer | |
  • Mischief? I prefer outright havoc and chaos! ;-) I had a similar problem where a very popular commercial media site hot linked several images way back in the day. I changed the images to a porn image and wha la! Problem solved. Although, it took about a week for them to notice. Their customers noticed quickly. What cracks me up is people wrote articles (news - before the days of blogs) about the incident. It became sorta famous. I guess I shoulda felt flattered? Nah. Not me. I am a stinker! Cheers!! – closetnoc Feb 28 '17 at 1:30
  • @closetnoc I have also used a porn image with great, rapid and hilarious success. I considered that as an example in the answer, but was trying to keep the SE standard above mine. :o) – Steve Feb 28 '17 at 1:51
  • That cracks me up. Great minds think alike! – closetnoc Feb 28 '17 at 2:16
  • I like what you did there. – wogsland Feb 28 '17 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.