Hotlink Protection: Stop Other Sites From Using Your Images and Bandwidth
Other websites may link directly to your files. Block it in your hosting panel or .htaccess.
Reference guide. This guide is written from established practice and the official documentation of the tools involved. We have not yet tested every step on a live demo site. Back up your site before you change anything.
Hotlinking means another site displays your images from your server, using your bandwidth.
Easiest: hosting panel
Many panels have a Hotlink protection tool. Add your own domain (with and without www, and http and https) as allowed, and choose which file types to protect.
.htaccess method
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?yourdomain\.com [NC]
RewriteRule \.(jpg|jpeg|png|gif|webp)$ - [F,NC]
Careful
- Allow social networks and search engines if you want images to appear in previews and search results.
- If your own images break, you may have blocked your CDN or a subdomain. See our images guide and our 403 guide.
High bandwidth?
See our bandwidth guide.
Related guides
- WordPress High CPU Usage From wp-cron.php: How to Reduce It
- WordPress Site Is Slow: Practical Steps to Speed It Up
- WordPress Site Slow After an Update: Find the Cause
- WordPress Images Look Stretched or Wrong Size: Regenerate Thumbnails
Did this solve it? If not, email hello@sitefixlab.org with the exact error text and we will look into it. Try the problem finder.