Basic hotlink protection .htaccess mod_rewrite scheme.
Hotlink protection can be very useful if you have a lot of people trying to hotlink to your images or files. Our article will show you a basic .htaccess mod_rewrite setup to block such hotlink protection for your domain.
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomainnamegoeshere.com [NC]
RewriteRule \.(jpg|jpeg|png|gif|bmp)$ - [NC,F,L]
The above script once entered into your .htaccess file (usually in your public_html or www directory) will prevent hotlinking for the listed file types. You can add more file types to block (ie. avi, flv, mov, mpeg, mkv, etc..) by editing the last line. Use pipes ‘|’ to separate the different file types.




