Snippets

Prevent hotlinking

Hotlinking (the act of using images from another site than yours) is unfortunely a common practice. This useful snippets will redirect all hotlinked images to a specific image, defined on line 6.

RewriteEngine On
#Replace ?mysite\.com/ with your blog url
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
#Replace /images/nohotlink.jpg with your "don't hotlink" image url
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpg [L]

Source: http://www.wprecipes.com/how-to-protect-your-wordpress-blog-...

Share this snippet

 
  • http://blogsnewsreviews.com Astro Gremlin

    This looks like a very useful snippet. If it’s needed. How can you tell if your site is being hotlinked?