1 min read

.htaccess Block hot linking from specific domains

  RewriteEngine On  
  RewriteCond %{HTTP_REFERER} ^http://(.+.)?myspace.com/ [NC,OR]  
  RewriteCond %{HTTP_REFERER} ^http://(.+.)?blogspot.com/ [NC,OR]  
  RewriteCond %{HTTP_REFERER} ^http://(.+.)?livejournal.com/ [NC]  
  RewriteRule .*.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpe [L]  

RewriteEngine On 
RewriteCond %{HTTP_REFERER} ^http://(.+.)?myspace.com/ [NC,OR] 
This condition was not met but the OR option made it pass

RewriteCond %{HTTP_REFERER} ^http://(.+.)?blogspot.com/ [NC,OR] 
This condition was not met but the OR option made it pass

RewriteCond %{HTTP_REFERER} ^http://(.+.)?livejournal.com/ [NC] 
This condition was not met but the previous OR option made it pass

RewriteRule .*.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpe [L]  
This rule was met, the new url is http://www.myspace.com/images/nohotlink.jpe
The tests are stopped because the L in your RewriteRule options

Share your Love

Leave a Reply

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