fbpx
How to disable image hotlinking in WordPress easily
Share on facebook
Share on twitter
Share on linkedin
Share on email
Share on whatsapp

How to Disable Image Hotlinking in WordPress? (3 Ways)

Website traffic is highly important for the success of any online business. And when a website follows the practice of image hotlinking, they are also doing damage to overall site performance, SEO, and image ranking.

Hence, you must understand the importance of restricting image hotlinking in WordPress before it turns out to be a disaster.

Before we dig in deep, let’s understand the definition of image hotlinking so you will better understanding how to safeguard your website and thereby enhance the security of the WordPress site.

Image Hotlinking: Definition

Image hotlinking is a practice followed by content stealers wherein they copy the image link of your site and directly paste them to their site.

It’s an unethical practice to use images of other websites. In image hotlinking, the content robbers are using the resources of the original image’s website. As a result, the website performance becomes sluggish.

Why Avoid Image Hotlinking?

Basically, image hotlinking is considered to be content stealing. It is so illegitimate that websites can send DMCA notices for stealing content.

This is one of the reasons why we always give hints about using non-copyrighted media content or content you have ownership of.

Now, let’s see the reasons why you should avoid image hotlinking:

Exhaust Server Resources:

Image hotlinking can drain the resources of the server from where the image has been taken.

To better understand this, let’s see an example:

You are on a shared hosting plan, and let’s assume that some high traffic website is linking your images to their post. What will happen here is that you will receive hundreds and thousands of queries to your site. This will result in resource exhaustion.

With ByteNAP’s Managed WordPress Hosting, we have hotlink protection in the first place. We ensure that we have a high quality so as to deliver you the optimal website performance.

Higher Bandwidth Bill:

As we explained to you with an example how hotlinking can result in server resource exhaustion.

So, now if you have chosen pay as you go plan, you will be charged extra for every additional server resource you use. However, this model is not the same with every web hosting provider.

Illegitimate and Copyright Issues:

Several websites on the internet have strict copyright policies. These copyright policies are set up in place so nobody can dare to steal media content from the site without anticipating legal consequences.

DMCA is created to stop content theft, illegal distribution, and data piracy. Original creator/writer should get the credit for his artwork/content.

How to Detect Image Hotlinking?

How to detect if someone is hotlinking your images?

In maximum cases, you will hardly recognize that someone is using your images for his personal benefit till you observe that the performance of your site has gradually been reduced.

You can follow our tried and tested method to detect hotlinking with ease.

Bandwidth Usage Check

Perform bandwidth usage checks at regular intervals. Look for the pattern, and if you find any traffic surge, analyze your bandwidth usage logs to determine who is consuming a huge chunk of your server bandwidth.

Check images in Google Image Search

To check if your images are being used on other websites, you simply type the below Google’s search operator

inurl:yourwebsite.com -site:yourwebsite.com

When you use this search operator, the results shown will be from another website, not yours.

Later, you can manually visit that page to check whether they are using your image on their website.

A good practice is that you prevent hotlinking images on WordPress

Look for new backlinks

To look for new backlinks, you can make use of the Powersuite tool. However, If you find any external backlinks (image links) on your website, then you need to manually look for its source.

If you find the image sources to be trustworthy, everything sounds to be good. And, by observing the site structure and pattern, you can easily know identify a spammy image website.

How to prevent hotlinking images on your WordPress site?

There are several ways to safeguard your images from hotlinking. Let’s see some of the options.

Use CDN for Protection against Hotlinking

Major websites across the globe use Content Delivery Network to improve their website performance and also to offer cached content copies from the visitor’s proximal data server.

Some of the widely famous CDNs like CloudFlare CDN, KeyCDN, etc have the ideal tools that offer assurance that your site will be secured even against image hotlinking protection.

WordPress being the most beginner-friendly website, you can enable/disable image hotlinking with ease.

Below are few steps to disable hotlinking in CloudFlare

  • First step is to login to the CloudFlare account
  • Pick the website where you want to disable hotlinking
  • From the toolbar menu, find Scrape Shield button and click on it
  • Search for the Hotlink Protection option and enable that option

Enable Hotlinking Protection on Nginx

If you are running a WordPress site is on an Nginx server, you simply need to add the below code to the config.php file.

location ~ .(gif|png|jpeg|jpg|svg)$ {
valid_referers none blocked ~.google. ~.bing. ~.yahoo. yourdomain.com *.yourdomain.com;
if ($invalid_referer) {
return 403;
}
}

For doing this task, you need assistance from your web hosting provider. In case, you are with ByteNAP, you need to raise a ticket and leave it to us, we got your back.

Enable Hotlinking Protection on Apache

If you are running your WordPress site on Apache, you can make some modifications to the .htaccess file and easily deactivate image hotlinking.

However, it is always a good practice to do a proper backup of the .htaccess file before you do any changes. We suggest you do so because backups will be handy even if something goes wrong.

  • Login to your cPanel
  • Open the file manager in cPanel
  • Navigate to the public_html folder (or the folder/ directory where the website is present)
  • Locate the .htaccess file
  • Open it to add few lines of code
  • Do the necessary changes and save the file

Below we have provided you with the code that you need to add it in your .htaccess file:

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://bytenap.com/hotlinking-placeholder.jpg [NC,R,L]

The second line of the code is simply a blank referrer

Starting from the third line, we can begin adding the domain that is enabled to hotlink the image. There, you need to add your domain name.

Fourth, the fifth and sixth line is for search engines, you don’t want them to be blocked

Eventually, the seventh line is for the image you want the user to see in place of hotlink protected image.

Conclusion

Image hotlinking is a serious issue if not controlled on time, it can prove to be disastrous.

ByteNAP is one of the best VPS Hosting Cheap Linux server provider in India with 24/7 efficient support, Free SSL & 100% Pure SSD Servers.

Leave a Comment

Your email address will not be published.

Our Experts will help you build the right solution or find the right partner for your needs.