Hotlinking is the process of placing a link to an image housed on another websever directly in your code. If people hotlink to your images, this will use your bandwidth instead of theirs,a lso known as bandwidth pirating. If enough people hotlink to images housed on your server, this can cause your account to use an increased amount of resources. This can slow down your site for legitimate visitors to your site.
You can prevent other sites from hotlinking to your images. Below are the instructions that demonstrate how to prevent hotlinking via your .htaccess file.
Preventing Hotlinking in your .htaccess file
- Log into your cPanel
- Access the File Manager for the Web Root folder of your domain. Be sure to also select the Show Hidden Files option.
- Once in the folder, find the .htaccess file and click on the Edit icon found in the toolbar across the top of the page. If you do not have an .htaccess file, you may need to create a blank one before clicking on the icon.
- You are now in the file editor. Place the following code into the .htaccess file. Be sure to replace the domain name example.com with your own domain name. Do not edit anything else in the code.
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.com/.*$ [NC]
RewriteRule \.(jpg|jpeg|gif|png|bmp)$ - [F]
- Click on the Save Changes button in the upper right corner of the editor to finalize and activate the code. Now anyone trying to hotlink to your images will not be able to display them on their site.
We value your feedback!
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
new! - Enter your name and email address above and we will post your feedback in the comments on this page!