Web development and examples of PHP, jQuery, HTML5, WordPress, MySQL & AMP

Hotlinking: avoid and detect the image hotlink on our website

The hotlink is more usual than we can imagine, there are people who hotlink images without being aware of it and others do it in a deliberate way.

After several years developing web pages I have experienced both cases:

  • Premeditated hotlinking: Webmasters steal (save) the bandwidth resulting from the transfer of images from the server to the users. This means that the ‘src’ of the images from the other’s website have the same url as those of our website, so they consume bandwidth from our server.
  • Not premeditated hotlink: This case is usually committed by beginners who have no experience in developing web pages, take the urls of the original images and reference them in their website without bad intention.

How to detect the hotlinking

There is no effective way to quickly detect if we are being consumed bandwidth by hotlinking:

  • Always insert internal links in the body of the text to other posts or sections of our website. In this way, if someone copies with scripts the content of the post (text and images), we would receive many visits from other websites that we would detect in our audience tracking system.
  • We will begin to notice that the bandwidth of our website increases, but not the number of visits. This could be the beginning of the image hotlink.

Blocking the hotlink of domain in .htaccess

In the upper code I have an example to avoid that the web domain.extension not take benefit of my images jpg, gif, jpeg and png. In addition I return an image to them that I choose (dissuasive) that puts: ‘This Web takes content without permission of our URL.

Block all types of hotlink to our website

This case is not usually used because at the SEO level it can affect us in websites such as google images, which refers to the photos on our website. But for who want to choose this option I provide you with the .htaccess code:

Cookie Policy

This website uses cookies to provide you with the best user experience. If you continue to browsing you are consenting to the acceptance of these cookies and acceptance of our cookie policy, click the link for more information.

Aviso de cookies