If you run your own web server or pay for it, it is recommended that you have some sort of measures to prevent bandwidth theft or hotlinking. However, there might come a time when you need to allow a third-party site to hotlink to a specific image or file.
I’m currently working with a digital marketing company that has something to do with publishing press releases. As part of the cooperation, they need to link to the banner I have on my Contact page but couldn’t because I have enabled hotlink protection through Cloudflare.
For those who aren’t familiar with hotlink protection or what it does, it basically prevents your images that are hosted on your web server from being used by other sites. Why do you want to prevent that? It reduces the bandwidth consumption on your web server and this can have a drastic effect not only on the server performance but could also cost you extra money.
Anyway, back to the topic at hand. I needed to figure out a way to allow third parties to hotlink to a specific image on my server. I checked out the Cloudflare Help Center and found an easy and simple solution so I’m going to share it here today.
All you need to do is create a directory (folder) on your server and name it hotlink-ok. This new directory can be placed anywhere on your server. You can do this via FTP, Cpanel, Plesk, or any control panel provided by your hosting provider.
HowTo: Allow Hotlinking To Specific Images on Cloudflare
Here are examples of URLs that will bypass the Cloudflare hotlink protection and allow third-party sites to hotlink to your specified images:
For this example, I used an imaginary file called “banner.jpg” and pretended to upload it on my server.
I believe there are other ways of doing this and there could even be a WordPress plugin created just for this but I think this is the best solution if you’re running a WordPress site using Cloudflare.
As you can see, it’s very easy and straightforward. Hope you find this useful in case you come across this same issue I had earlier this week.
If you have any questions or have any comments regarding this post, please feel free to share them by leaving a comment below.
This post may contain affiliate links that allow us to earn commissions at no additional cost to you. We are reader-supported so when you buy through the affiliate links, you are also helping or supporting us.