Have you noticed someone stealing your images, directly taking the URL and display on their websites without your permission? This is what we call Image Hotlinking. It is bad, as it not only stealing our images, it also take advantage of our bandwidths.

Copy and Paste Following in .htaccess to Prevent Image Hotlinking

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain\.com [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?otherdomain\.com [NC]
RewriteRule \.(gif|jpe?g|js|css)$ - [F,NC,L]

Blacklist a Set of Domains from Hotlinking

RewriteCond %{HTTP_REFERER} ^http://(www\.)?baddomain1\.com [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?baddomain2\.com [NC]
RewriteRule \.(gif|jpe?g|js|css)$ - [F,NC,L]

Have Questions? Comment Below !