Advertisements

Are you also suffering from Hotlinking issues? Well, this is a common problem when running a website, especially an image website.

Hotlinking is one of the main problems that a website owner faces. Most of the websites have been hunted through hotlinking. 

Will it be good for you if your website resources are eaten by someone else, and if your website bandwidth is consumed by other websites? Definitely, your answer will be No. 

It will cost you more money if your website resources are eaten by other websites and bandwidth gets consumed. 

Advertisements

This will be the worst thing a blogger can face. Don’t worry, in this detailed article, we will solve all your problems regarding Hotlinking.

In this post, we are going to share with you multiple ways for how to prevent hotlinking in your WordPress site, and apart from that we also guide you about What is Hotlinking?

What is Hotlinking

Hotlinking is the process of stealing someone’s website bandwidth by directly adding assets from one website to another. These assets can be images, videos, or audio. It might be very confusing for you, so let me explain it to you with an example.

 Suppose that you are running a website: For example, yoursite.com, and you have posted some images on it. For reference let the image hosted on your website is on the URL = https://yourwebsite.com/mask.jpg. Now this image is loaded for this URL is permanent your website bandwidth is used. 

If someone had added this image via your URL then whenever his website has loaded the image posted on your server is also loaded. Even the user is not giving your website to your bank which is being consumed because the back image that another website is using is directly taken from your server. This is called hotlinking in easy and simple words.

How To Prevent Website From Hotlinking:

Now the question that arises is what is the way to prevent a website from Hotlinking? Well, we have some good news for you. We will share some methods by using them you can definitely prevent your website from hotlinking. 

There are several methods for this, and using them, can be handy to prevent hotlinking from our WordPress website. So without any further delay lets the following steps:

Prevent website from Hotlinking By using CDN:

CND is the best way to prevent Hotlinking, you can prevent this using CDN. It stands for Content Delivery Network. It is widely used by websites across the globe to deliver their content faster and it also increases website loading speed. Most of the content delivery networks come within Hotlink protection. Some of the famous content delivery networks that you can use are KeyCDN and Cloudflare. You can ask your provider about this feature.

NGINX Server:

NGINX servers can also help you to prevent Hotlinking so If your website is running on an NGINX server then we have a quick and simple solution for you. Just open your standard config file and add the following code to your config file.

location ~ .(gif|png|jpeg|jpg|svg)$ {

     valid_referers none blocked ~.google. ~.bing. ~.yahoo. yourdomain.com *.yourdomain.com;

     if ($invalid_referer) {

        return  

403;

    }}

Apache Server:

Nowadays most websites are hosted on an Apache server. If your website is hosted on an Apache server then you can follow these simple steps to enable hotlink protection on an Apache server is easier than you might think.

Open the .htaccess file that can be found in the root directory of your website and add the following code. If the .htaccess file is not found then simply create one.

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|svg)$ http://dropbox.com/hotlink-placeholder.jpg [NC,R,L]

Prevent Hotlinking In WordPress Website By Using Plugin:

If you are not familiar with coding and all that, don’t worry we have other methods too. There are multiple WordPress plugins available that can help you in this. 

You can use WordPress plugins to prevent hotlinking. Many plugins are best and available for WordPress that will make this task easy. You can simply go to the WordPress plugin store and then search for hotlink protection and you can install the plugin according to your choice. 

But most of the free plugins are outdated, they don’t get regular updates or maintenance, and are also not suitable for your latest WordPress version, so here we mention.

3 Best Plugin To Prevent Hotlinking In WordPress:

  • Disable Right Click For WP plugin: You can Simply disable right-click on your WordPress website. Just go to the WordPress dashboard and click on add more plugin search for disable right click and activate this plugin. After installation and activation of this plugin, a right-click will not work on your website and no one will be able to copy the link of resources like images and videos from the website. Don’t worry there is a question in this plugin that will allow you to enable right-clicking for admin or logged-in users.
  • Hotlink File Prevention: This is one of the best WordPress plugins which is freely available in the WordPress plugin store and it can help you with Hotlink Prevention. Whenever you will upload any media in WordPress this plugin will automatically add a Hotlink protection option to that media. If you enable that option then it will automatically prevent hotlink.
  • All In One WP Security & Firewall: Mostly recommended and trusted plugin. By using this plugin you can solve all security-related problems on your WordPress website. This is an All In One WP Security & Firewall plugin. As its name suggests it is a complete WordPress security package. It can enhance your Website Security and even prevent your site from malware and hacking attempts. Install & Activate this plugin and go to WP Security -> Firewall -> Prevent HotLink -> Enable It and Save. Now your website is completely protected from hotlinking. 

Prevent Hotlinking By Using cPanel:

If you are using cPanel then you have a predefined option for hotlink protection. Nowadays most websites are using shared hosting and shared hosting comes with cPanel. If you are also using cPanel then follow the below steps and activate hotlink protection.

  • Open cPanel and search for Hotlink Protection.
  • Click on the Enable button to enable it.
  • By default, hotlink protection will exclude the subdomain that you have made.
  • You can make any changes there if you want to make them.
  • Once everything is configured simply click on the submit button.
  • Click on submit and everything is done.

Last Word:

Hotlinking is the biggest problem for every website owner because it uses unnecessary bandwidth for your site. But luckily there are ways available, and by using them, you can easily prevent hotlinking.

This article is all about Hotlinking and in this post we have shared multiple ways for this, you can choose any of them that suits you. 

Advertisements
Author