click here to skip the menu and go to the page content

rebecca's pocket

about / archive / syndicate

.: July 2006 --> Prevent hotlinking without mod_rewrite

Prevent hotlinking without mod_rewrite

» Web Publishers: a recipe for preventing hotlinking without the use of mod_rewrite, courtesy of the fine support staff at my Web host, Pair. Add this bit of code to your .htaccess file:

SetEnvIfNoCase Referer "^" valid_link=1
SetEnvIfNoCase Referer "^" valid_link=1
SetEnvIfNoCase Referer "^$" valid_link=1

<FilesMatch "\.(gif|png|jpe?g)$">
Order Allow,Deny
Allow from env=valid_link

Change "" to your own domain. No, I can't troubleshoot it for you.

 [ 07.14.06 ]


Nice. Thanks for sharing. But I have a question. You may not be able to answer it, but your readers may be able to.

Is there an easy way to tell when you are being hotlinked?

I find out when I look at my referrer logs (or however you get your Web stats).

I look at my referrer logs, but have not actually looked with an eye to discovering hotlinking. I'll give it another go. Thanks.

I have always found them by accident: a new referrer, I check to see what the person has linked to, and then, instead of a link, there is an image from my site on the page. (You can check source to see whether it's been linked directly from your site.)

In any case, if you prevent hotlinking you don't need to worry about it at all.



» primary link / supplemental information / internal link

my book

» the weblog handbook
amazon editors' best of 2002, digital culture

recent posts