One of the more important elements of the posts that you create on your website is the images that you use.
Even the best, most informative article can typically benefit from the inclusion of some pictures to help get your point across, and break up the monotony of text.
But other site owners might like your site’s images and decide to use them for their own purposes.
If they use the actual image that is stored on your Web server, then it is using the resources on your server to display the image on their site.
That’s called hotlinking, and it’s generally not a good thing.
Fortunately, Cloudflare has a setting where you can prevent the hotlinking of your images.
- Sign in to Cloudflare.
- Select your site.
- Choose Scrape Sheild in the left column.
- Turn on Hotlink Protection.
Our guide continues below with additional information on protecting your website’s images from hotlinking, including pictures of these steps.
The steps in this guide assume that you have previously set up Cloudflare so that your site is using its features. If not, this article will show you how to get set up.
Step 1: Go to https://www.cloudflare.com and sign into your account.
Step 2: Choose the site for which you wish to enable hotlink protection.
Step 3: Click the Scrape Shield button in the toolbar at the top of the window.
In newer versions of the Cloudflare Web app you will find the Scrape Shield option in the column at the left side of the window.
Step 4: Click the button to the right of Hotlink Protection to turn the setting on.
Note that Hotlink Protection will prevent your images from being displayed in places like Google Images and Pinterest. So if those sites are important to your site, then you may want to consider not using Hotlink Protection.
Our tutorial continues below with additional discussion about how to enable or disable hotlink protection in Cloudflare.
The steps in this article are specifically about the hotlink image protection feature if you use Cloudflare, and you have it enabled.
It’s possible to use Cloudflare just for their DNS, so you may not be able ot take advantage of the hotlink protection if Cloudflare is not enabled as a proxy. You can check this by clicking the DNS option in the left column. If the cloud icon is gray instead of orange next to your DNS records, then you aren’t using Cloudfalre to protect your site. You can turn it on if you want to use Cloudflare’s protection.
Note that enabling Cloudflare for things other than DNS can affect behavior, caching, and more. you will want to check your site after enabling Cloudflare to make sure that there aren’t any unusual or unwanted effects.
Some Web hosting account providers will have ways for you to block direct access to your images form external domains, although the method for doing so can vary significantly, as many of their user interfaces or cPanel setups can be pretty different. You may also need to adjust some settings in your .htaccess file to make hotlinking protection work with your hosting provider.
As we mentioned above, choosing to prevent hotlinking and block other websites or website owners from accessing your hotlinked files with a direct link can help if you are finding that it is taxing your origin server resources by allowing this bandwidth theft.
If you are using a CDN (content delivery network) and haven’t noticed any significant changes to usage or performance then you may not need to stop other sites from linking to the image directly if there aren’t any negative effects on your resources or expenses.
Matt has been working with WordPress and creating content using this powerful content management system for years. While he has written about many other tech topics, WordPress is one of his favorites.
You can read his full bio here.