You Can't Touch This

June 12, 2004

Thanks to’s preventing image hotlinking article I now have protected to some degree my site’s images.

The process is relatively simple, create a new .htaccess file for your images subfolder (you do have an images subfolder, right?) and paste the following code in it.

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?*$ [NC]
RewriteRule .*.(gif|jpg|jpeg|png)$ - [F,NC]


Author's profile picture

Mark H. Nichols

I am a husband, cellist, code prole, nerd, technologist, and all around good guy living and working in fly-over country. You should follow me on Twitter.