How To Prevent Image Hotlinking With .htaccess

Above image is from, and I haven’t just copy and pasted it into this post. This image is stored in my hosting server. If someone is stealing images directly from your website then he’s also using your bandwidth space. Every single view of our images on their site cost us our bandwidth and we paying our valuable money for it.

You can stop others from hotlinking your images with a simple snippet. Just add following to your .htaccess file to prevent others from hotlinking your images:

Now all sites are blocked from hotlinking, even your own website. So in above code, replace with your website’s domain. You can add as many URLs as you want in to your hotlinking whitelist.

You can also add an image which will show up whenever image hotlinking is detected. Just replace IMAGEURL in above code with the URL of your image. Make sure where this image is not hotlink protected.