Hot link protection

Simple hot link protection using .htaccess

 RewriteEngine on
 #RewriteCond %{HTTP_REFERER} !^$
 RewriteCond %{REQUEST_FILENAME} -f
 RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g?|png)$ [NC]
 RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?your-domain\. [NC]
 RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?google\. [NC]
 RewriteRule \.(gif|jpe?g?|png|bmp)$ http://your-domain/hotlinkdenied [R,L]

  • Replace your-domain with your actual¬†domain name
  • Replace http://your-domain/hotlinkdenied¬†with a valid url

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.