Internet Resource

How to Stop Hotlinks Use .htaccess

This post will tell you how to stop hotlinks using .htaccess file to protect your websites traffic. It is very easy to use.
Stop and prevent hotlink bandwidth theft, hotlinking, file leeching, bandwidth bandits, hot links, bandwidth leeching, hotlinks, external linking.
The solution was to write an .htaccess file to block hotlinks, and place it in your website main directory. The code looks something like this:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^*$ [NC]
RewriteCond %{HTTP_REFERER} !^$ [NC]
RewriteCond %{HTTP_REFERER} !^*$ [NC]
RewriteCond %{HTTP_REFERER} !^$ [NC]
RewriteRule .*.(jpg|jpeg|gif|png|bmp|rar|zip|exe)$[R,NC]


Green part: change to your domain;

Blue part: These are the files you want to protect;

Red part: The url is the error image.

Save the .htaccess file and upload it to your server. That’s it.
(Warning: Do not use .htaccess to redirect image hotlinks to another HTML page or server that isn’t your own (such as this html page). Hotlinked images can only be replaced by other images, not with an HTML page.)

Of course, if this solution can not work, you can get more solutions here.

If you use cPanel, it is easier to stop hot linking!
A cPanel functionality, known as HotLink protection prevents other websites from directly linking to files on your website. This means that when another website is visited, it cannot load pictures from your pages – this is one of the ways for limiting the outbound traffic for your account.

An example of hotlinking would be a different website using HTML code to display an image from your site. In effect, the other website is using up your bandwidth quota.

Please click on the HotLink Protection icon in the cPanel’s main page and follow the instructions. Include the websites you wish to have access to your files – those may be affiliates or friends, linking to your banners, etc.
cPanel - Hotlink Protection

In order to allow certain file types to be accessed, please enter their extensions in the space provided – this way you can allow other websites to reach for your images, but disallow video or audio files from being accessed.

cPanel attempts to add all the domain names that you own with SiteGround to the allowed list, still if you have accounts on other servers you may need to have some of those added manually.

Make sure that you include all sites that need to access your protected files in the first bank field or they will not be able to view the files. If you still cannot view a file, try disabling Hotlink Protection to see if it is the cause of the problem.