Prevent Image Hotlinking
Put this piece of code in your .httaccess
file on the Apache web server and it will automatically block all image requests coming from specified domains.
The website requesting the image resource will be returned a 403 Forbidden error.
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(www\.)?example\.ru(/.*)*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?example\.cn(/.*)*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?leecher\.com(/.*)*$ [NC]
RewriteRule \.(jpeg|JPEG|jpe|JPE|jpg|JPG|gif|GIF|png|PNG)$ - [F]
Amit Agarwal
Google Developer Expert, Google Cloud Champion
Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.
Amit has developed several popular Google add-ons including Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory