‪(502) 437-9619 hello@thesproutstudio.com

What is a Hotlinking?

Hotlinking is also know as as inline linking, leeching, piggy-backing, direct linking, and offsite image grabs.

Basically, instead of linking to an image on your own server, you link to an image on someone else’s server.

So why is it bad? When a user goes to your website, their computer will download all images to display them in there browser. If you are hotlinking, the images will be downloaded from the other server instead of yours. This means that their bandwidth will be used instead of yours. Good for you, not nice for them.

Hotlinking often involves taking someone’s content tool. A blog may hotlink to images in another article, claiming it as their own. Also, not good etiquette.

How Do You Search for Hotlinking?

Until recently, there was no easy way to find it. You had to analyse your server logs or compare them to a service like Google Analytics. These methods were not reliable, and usually time consuming.

Thanks to the magic of Google Image Search, it is now very easy to do! (I originally found this tip on ScottishMum.com)

You tell Google to search for all images that link to your site, but are not on your site. Here is the simple search string:  inurl:mydomain.com -site:mydomain.com.

To make it easier, you can use this simple form that will do it for you. Just type your domain in and it will send you to google image search.

Use the format “domain.com”

How Do You Stop Hotlinking?

Now that you found it, what do you do? The easiest way is to use the tool in cPanel (this comes with most good hosting companies, like Sprout Studio). Just follow the instructions (it’s fairly easy).

cPanel Hotlinking Protection

No cPanel? If your hosting company does not have cPanel or you don’t have access, there is still hope.

You can edit (or add) a configuration file, called “.htaccess” This can be intimidating and it is possible to break something if you don’t know what you are doing.

This configuration will tell your server to send a different image if a different domain requests it.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mydomain.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ donthotlink.jpg [NC,R,L]

This code will change any images to donothotlink.jpg (allowing you to replace hotlinked images with any other image).

Line by line:

  1. Tell your server that you are going to use the rewrite module. If you use wordpress, this line is already there and does not need to be repeated.
  2. Allow blank referrer. (In case someone is trying to access your site through a proxy)
  3. Allow anyone coming from your site (mydomain.com in the example).
  4. Actually rewrite any image files to donothotlink.jpg

There is a great resource that can generate the code for you on htaccesstools.com

What If You Hotlink?

You may have been running your blog for years and suddenly realize you have been hotlinking the entire time. How do you go back and fix all those images?

If you already had permission to use the images, but want to host them on your server, there is an easy solution (if you use wordpress that is). There is an easy to use plugin called Import External Images. This will go through all your posts and download externally linked media files, then relink them. Very cool!

I hope that helps!