What is a hotlink? How to block hotlinks

Why is hotlink annoying for you? While a hotlink is great for URL sharers, it can cause problems for content owners. First of all, such actions may be considered piracy, since the image is displayed without information about the author. Second, the hotlink uses the resources (bandwidth) of the hosting account where the website is hosted.

What is a hotlink? How to block hotlinks Picture 1

How do I know if the image you own is hotlink or not?

There is an accurate and really simple way to check if the image you host is hotlinked - Google Images. The following command must be inserted in the search bar:

inurl:yourdomain.com -site:yourdomain.com

Use your domain instead of yourdomain.com.

It looks for all the image links on your site, automatically removes from the results legitimate links (those that you actually own), and leaves only the hotlinked URLs.

Protect against hotlinks and SEO

You may be wondering if hotlink protection affects your site's ranking. The answer is no. Your website may load even faster because its bandwidth is not affected by constant illegal requests from re-posted images. And that actually improves your rankings.

The issue occurs when the protection against hotlink is not implemented properly and blocks access to the crawler image. This prevents the image from showing up in search results or even the web page from being indexed correctly.

How to block WordPress hotlinks

What is a hotlink? How to block hotlinks Picture 2

There are many plugins that provide anti-hotlink protection. For example, you can choose All In One WP Security And Firewall as the versatile plugin for WordPress. Script Configurable Hotlink Protection solves only one problem and allows configuring block severity (block).

When using any plugin of this type, make sure to back up your account before making any changes. Another useful tip is to clear the plugin cache after enabling anti-hotlink protection (in case you use it).

General .htaccess rules

The hotlink can be blocked by editing the .htaccess file in the root directory of the domain in question. It allows to disable the use of URLs directly to files, but does not block them from displaying on the original web page. The following rule will be added to .htaccess:

RewriteEngine on RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?yourdomain.com [NC] RewriteRule .(jpg|jpeg|png|gif)$ - [NC,F,L]

Replace yourdomain.com with the real site name and jpg | jpeg | png | gif are the file types to protect.

This rule allows requests from firewall users and specific antivirus programs to hide information about the sender of the request. This will prevent a visitor with such settings from viewing media content on the website, in particular protected images.

To have a custom page that says hotlinks are not allowed, instead of the usual error message, you can slightly modify the rule. Need to specify the file to be displayed instead of the image to be hotlinked. The file must be created and uploaded to an unbounded directory for direct viewing and linking. For example, it could be a subdomain, created specifically for this purpose, or an open media memory. The rule with custom error image binding would look like this:

RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www.)?yourdomain.com/.*$ [NC] RewriteRule .(jpg|jpeg|png|gif)$ http://domain.com/nohotlinking.jpg [NC,R,L]

Or:

RewriteEngine on RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?yourdomain.com [NC] RewriteRule .(jpg|jpeg|png|gif)$ http://domain.com/nohotlinking.jpg [NC,R,L]

Where http://domain.com/nohotlinking.jpg is a direct link to the image you are using as a custom error message.

While this helps prevent your bandwidth from being stolen and maintains stable website performance, you may still want to allow some search engines and social media platforms to access your files. This will allow the image to be displayed in search results and shared via widgets. For this purpose, the hotlink protection rule can be added to the .htaccess file with special lines, specifying the allowed requests:

RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?yourdomain.com [NC] RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?google.com [NC] RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?bing.com [NC] RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?yahoo.com [NC] RewriteRule .(jpg|jpeg|png|gif)$ http://domain.com/nohotlinking.jpg [NC,R,L]

Replace yourdomain.com with the real site name and jpg | jpeg | png | gif are the file types to protect.

5 ★ | 1 Vote

May be interested

  • How to block any call on your Android phoneHow to block any call on your Android phone
    to avoid being disturbed by strangers or in the middle of the night, strange phone numbers were called to annoy. even if this situation continues, it makes you uncomfortable and frustrated. the best way is to set up blocking these strange phone numbers on your android phone to prevent harassment.
  • How to block someone on Snapchat?How to block someone on Snapchat?
    someone annoys you, annoys you on snapchat, how can you block them? this article will guide you how to block someone on this social networking application.
  • How to block websites on FirefoxHow to block websites on Firefox
    to block websites on firefox, we will need to install a website blocking extension on your computer or install an app on your phone to block.
  • Instructions on how to block ads when surfing the web on FirefoxInstructions on how to block ads when surfing the web on Firefox
    in the past, ads used to appear on a small portion of the website, but today ads often appear a lot, even taking up most of the site. so how to block these annoying annoying ads? if you use
  • How to block ads on ViberHow to block ads on Viber
    sometimes, ads on viber are annoying to users. here are tips to help you block ads from viber to no longer be bothered.
  • How to block tagging your TikTok accountHow to block tagging your TikTok account
    other people can tag your tiktok account in comments, photos or in the diary posted on tiktok. to block others from tagging your tiktok account is very simple, according to the article below.
  • How to block ads on FirefoxHow to block ads on Firefox
    how to block ads on firefox. surfing the web on firefox may also come across ads that are constantly appearing, making you feel uncomfortable because the content you want to view is hidden, and can even lead you to malicious links. the following article will show you how to block ads on firefox simply and effectively.
  • Instructions to block someone's posts on ThreadsInstructions to block someone's posts on Threads
    to block someone's posts on threads, users have many different ways to block, such as blocking right in the home interface or in that person's profile.
  • Instructions on how to block spam phone numbers on iPhoneInstructions on how to block spam phone numbers on iPhone
    if you are using an iphone and are constantly bothered by calls for financial, insurance, education or real estate advice ... which makes you feel very uncomfortable, you can apply the following way of tipsmake.com.
  • Block ads on Google Chrome, Firefox, IE with AdblockBlock ads on Google Chrome, Firefox, IE with Adblock
    to block ads on google chrome, firefox, internet explorer, you just need to install more add-ons. the article shows you how to install add-ons for web browsers to block ads on web browsers.