How to Disable Image Hotlinking in WordPress easily?

Image hotlinking can affect the website performance, SEO, traffic, image rankings and cost you money in terms of bandwidth bill.

That’s why you must understand what it is and how you can prevent it from doing any harm to your website.

This post will show you how to disable image hotlinking to protect your content and harden WordPress security.

What is image hotlinking?

Image hotlinking means when an image is embedded in a website by directly copying the URL of the image to another website. The stolen image uses the resource of the source website.

It is a very convenient and easy way to share the image. The modern web takes a lot of benefit from this process. But it is technically stealing the image from the website.

Worse is you are even using the resource of another website to serve the image you stole from the site.

Using URL to embed the image directly affects the performance of the website the image is picked from.

Must Read: 8 Types of Image Files and When to use Them

Why is hotlinking bad?

First of all, image hotlinking is a theft. It is illegal, and many websites can send a DMCA notice to your website.

We always suggest you use copyright-free images or the image you own. Besides the theft, there are other reasons hotlinking is bad for the website:

Cost bandwidth money:

The website that embeds the image by hotlinking it serves the images from the source. The user is browsing site A while the image is loading and using the resources of site B. 

It affects site B’s performance as it uses the bandwidth of site B to serve the image of site A.

One popular example is Mathew Inman, whose comic image has been hotlinked by HuffingtonPost, and it cost him $1000+ in AWS bill.

Cost server resources:

If a high-traffic website starts hotlinking your website’s images, it will put pressure on your web hosting.

Good chances are your hosting account could be suspended due to an unexpected spike in resource consumption. That’s why you should have a scalable hosting.

With ServerGuy WordPress hosting, your website will be safe, as we keep the alert about these issues and make proper changes accordingly.

Poor website links:

With hotlinking on comes the black hat SEOs that can scrap the website’s image to display on their automated image websites.

Many small and large websites do nothing but collect images from the web and show them on one page. Now they are not hosting these images; they are only hotlinking them. 

These provide the bad link neighborhood to your website images.

Illegal and copyright issues:

The majority of the large websites have strong and dedicated copyright policies. No one cannot steal their images and content without expecting the consequences.

Digital Millennium Copyright Act (DMCA) works as an intermediary to protect the content copyrights for small bloggers and business owners.

Using images without a proper license and copyright issues can land you in legal trouble, and you can end up with no website or a hefty fee.

Does hotlinking affect SEO?

Aaron Pratt is a member of Google Groups Webmaster Help Discussion, and he answers this question with:

anything linked to including images shows that people out there might like what you have; google then has to determine if the linking is real or make-believe. 🙂

This means if the hot-linked image has a link to the website URL, then it will be treated as the image link. 

However, if the image links to the image URL, then the link credit will be given to the image, helping or reducing its chances of appearing in the image search.

So, yes, if the link is there, it will affect the image SEO of the website. Negative or positive, it depends on the website that hotlink the image.

Detect Image Hotlinking

How to detect if someone is hotlinking your images? It isn’t easy to detect the image hotlinking quickly, but there are few ways. 

Check the bandwidth usage: Any sudden spike in the bandwidth usage can mean many things, but it can also mean that someone has hotlinked all of your images to some web 2.0.

Check out the usage logs to identify the files that are consuming a large part of the bandwidth.

Check new backlinks: You can use Powersuite to find the new backlinks. If there are image backlinks to the site, you have to check out the source.

If the source is credible, everything is fine, but you would know if it is a spammy image site.

Check the Google Image search: Use this simple command to see your website images on the other website’s URL.

With this command, you can remove your website from the search results, and it will only display the website with your image.

Then you can visit the page and website to check out why they are hotlinking your image or if you need to take any action.

The best thing to do is disable the hotlinking on the WordPress site, so such problems do not waste your time at all.

How to disable image hotlinking on the WordPress site?

WordPress allows you to disable the image hotlinking. In this post, I will tell you a few ways.

  1. Using a CDN
  2. Apache
  3. NGINX
  4. WordPress Plugins
  5. Rename URLs
  6. Watermark images

#1 Using a CDN

Content Delivery Network speeds up the WordPress site by serving the cached copy of the content from the visitor’s nearest data server.

Popular CDN like CloudFlare, KeyCDN, etc., have great tools to provide security to the website, including image hotlinking protection.

With a click, you can disable/enable image hotlinking on the WordPress site. This is the simplest, error-free, and most straightforward method to disable hotlinking.

Disable hotlinking in CloudFlare:

  1. Login to the CloudFlare account
  2. Choose the site you want to work on
  3. Click the Scrape Shield button in the toolbar
  4. Find the Hotlink Protection option and enable it

KeyCDN has a different method to enable hotlinking on the site. You have to add a zone referrer.

#2 Hotlink Images on Apache

If your WordPress site is on Apache, you can disable image hotlinking by adding a few lines of code to the .htaccess file.

Take a backup of the htaccess file before making any changes.

  1. Login to the cPanel or the control panel your hosting provider provides
  2. Open the file manager
  3. Go to the public_html folder (or the folder where your site is)
  4. Find the .htaccess file
  5. Edit it to add code
  6. Save the changes

Code to copy and paste into the .htaccess file:

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

The first line of the code is just a blank referrer for the people who use personal firewalls and anti-viruses. 

From the second line, we start adding the domain that is allowed to hotlink the image. That is your domain (replace it with your domain name), Google, Bing, and other search engines.

You can copy-paste the line as many times to add more websites to allow a list. You may like to add Facebook, Twitter, and Social Media sites to the allow list.

Finally, the last line indicates the format of files you are applying to the hotlink prevention. The URL in the last line is of the image shown at the place of your image when someone tries to embed it. You can change it.

#3 Hotlink Images on Nginx

If your WordPress website is on an Nginx server, you must open the wp-config.php file to add the following command.

location ~ .(gif|png|jpeg|jpg|svg)$ {
     valid_referers none blocked *;
     if ($invalid_referer) {
        return 403;

You have to take help from your hosting provider to do this. If you are with ServerGuy, raise a ticket, and we will help you with the image hotlinking.

#4 WordPress Plugins

There are plugins for everything in the WordPress ecosystem. That’s what makes it so popular among website makers.

You can search for the ‘hotlink’ to find the plugins that will solve this problem.

Disable Image Hotlink in WordPress Plugin

However, these plugins are not recommended to disable hotlink in WordPress. They are not maintained and updated timely. Unsecure plugins and outdated plugins are the biggest reason for WordPress hacking

Using CDN to prevent hotlinking is the best solution. The second best is to add the rules to the server-side, depending on the webserver you are using.

However, if you are adamant about using a plugin, you should use All In One WP Security & Firewall. The plugin is popular for securing WordPress websites, has good ratings and a large number of installations.

AIO WP Security has the feature to prevent image hotlinking.

Once installed and activated, go to WP Security -> Firewall -> Prevent Hotlinks. You can check Prevent Image Hotlinking and click Save Settings.

#5 Rename URLs

As you understand, image hotlinking works because one can embed the image URL to another site. So to break that embedding, you only have to change the URL.

The old URL will show 404 errors at the place of the image hotlinked.

It is not an ideal method to get back at the hotlinks. Changing the URL of the image hurts the SEO, as the URL creates authority with time. It may also break the image embedded on your website.

Also, if the site is large, it will take a long time to change the URL of each image. Having a proper image name and image URL is critical for image SEO.

You can use the Media File Renamer plugin to change the image name automatically.

Media File Renamer

#6 Watermark Images

Watermarking images is not a solution, but it is an effective way to add branding to your content. Even if anyone embeds your image to their site, they will not remove the watermark.

To remove the watermark, they have to download the image, photoshop out the watermark, and reupload it. Embedding directly from the website will ensure that the watermark sticks and the user knows the source of the image.

There are many plugins, but most of them are outdated and may not be compatible with current WordPress versions.

Image Watermark for Image Hotlink WordPRess

However, Image Watermark still has active installation and positive reviews. The recent reviews are two months old.

Image Watermark Plugin Reviews

Though take backup and ensure WordPress sites have other security protections before using any outdated plugin.

Also Read:

Wrap Up

Image hotlinking is a problem for lots of people. It costs many website owners money, time, and bandwidth.

If you are a content creator, protect your work by preventing hotlinking of images. Use any of the mentioned methods to prevent image theft. By letting other websites your content, you are losing the visitors while they are enjoying your traffic.

However, please provide proper attribution if you run a website that displays the content from multiple websites and hotlink images. Also, take the permission of the website owners before adding their site to your database.

If you have ever encountered an image hotlinking problem, tell me in the comment box.

Latest WordPress Tips, Guides, & News

Stay updated with new stuff in the WP ecosystem including exclusive deals, how-to articles, new plugins, and more. 100% WordPress Goodness, a promise!

3 thoughts on “How to Disable Image Hotlinking in WordPress easily?”

  1. Hello!

    If your WordPress website is on an Nginx server, you must open the config.php file to add the following command.

    For this area, are you referring to the wp-config.php file? I just want to make sure I put the code in the right spot.


    1. Hello Marcy,

      Sorry for not being clear in the article. Yes, we meant the wp-config.php file.

      Update: we updated the article.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top

We can help you. Right now.

Fast growing merchants depend ServerGuy for high-performance hosting. Experience counts. Let's get started.

Talk to a sales representative

USA / Worldwide




Core Web Vitals Book COver

Is your website ready for Core Web Vitals?

Take this FREE book with you and optimize your store for speed.

Learn all about new Google new ranking factors and get that top ranking.