How to add hotlink protection in .htaccess

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

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.

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.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)

The article is too difficult or too technical to follow.
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.

How did you find this article?

Please tell us how we can improve this article:

Email Address

Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!