Enable Hotlink Protection for Specific Sites

If you read my previous post on hotlinking, you may be wondering how you can block these offending sites. Often, enabling hotlink protection will break your newsletters and feeds, so I recommend blocking individual sites.

To block specific sites:

  1. Open up your cPanel and visit the File Manager once again. This time, select Web Root in the pop up box. Also, check the “Show Hidden Files (dotfiles)” box.
  2. Web Root FTP
  3. Select the .htaccess file and click Edit. Click Edit again in the pop up box.
  4. Insert the following code at the very top of the file. Replace the domain as necessary. For example, if google.com were hotlinking your image, enter google.com
  5. # Hotlink Protection
    RewriteEngine On
    RewriteCond %{HTTP_REFERER} ^http://domainhere.com/ [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(.+\.)?domainhere\.com/ [NC]
    RewriteRule .*\.(jpe?g|gif|bmp|png)$ - [F]
  6. Repeat for other offending domains and save the file.

This is what the code has done. Here’s the image before:

Hotlink Before

And here’s what it looks like after:

Hotlink After

As you can see, the image is not being displayed, and is not using any bandwidth.

Don’t know how to find out if your images are being hotlinked? You can find out through a simple AWStats hack.

About Mitchell Wischmann

Mitchell is a sophomore in college, and also runs a savings website, FrugalFinders.com. He started this site to share tips and tricks, how-tos, and to offer WordPress blog support.

Trackbacks

  1. [...] block your image from appearing on their site. This is a separate topic and will be covered in an upcoming post.Filed Under: htaccess, WordPress · About Mitchell WischmannMitchell is a senior in high [...]

  2. [...] Hotlinking is when someone steals bandwidth from you by calling the image from your site. Disabling hotlinking reduces the load on your server, and also saves on your hosting costs. To disable hotlinking, you can head over to my site for the code. [...]

Speak Your Mind

*