HTAccess block linking to your images

By mike on October 24, 2011 in Snippet
w0
k 0

through the power of .htaccess we can prevent anyone from linking to images on your site. If someone tries to post an image from your site in their blog, you can redirect it to a new image of your choosing.

Basically this is checking if theĀ referrerĀ of the image is your domain, if it is not, then give them /images/youre-a-bad-boy.jpg to discourage them.

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+.)?mikepayne.co/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*.(jpe?g|gif|bmp|png)$ /images//images/youre-a-bad-boy.jpg [L]

0 Comments

Leave a reply

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>