Home > Bookmarks, Hosting > Stop Hotlinking

Stop Hotlinking

October 29th, 2007 Leave a comment Go to comments

Ex: Your site is www.myblog.com. To stop hotlinking of your images from other sites and display a other image called nothotlink.jpe placed in your images directory, place this code in your .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?myblog\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nothotlink.jpe [L]

For stop hotlinking from specific outside domains only, such as myspace.com and blogspot.com but allow any other site to hotlink images:

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

  1. No comments yet.
  1. No trackbacks yet.
GoCache - ByREV-Cache v1.0 - live served in : 0.15261 sec (gzip)