blocking hotlinking with .htaccess only works for plain domain, when preceeded by www no block
Posted
by
casualprogrammer
on Server Fault
See other posts from Server Fault
or by casualprogrammer
Published on 2011-01-06T17:28:18Z
Indexed on
2011/01/06
17:55 UTC
Read the original article
Hit count: 295
.htaccess
|hotlinking
Having tried all sorts of suggestions popping up from google, I am at my wit's end.
Presently I use a solution created with htaccesstools.com/hotlink-protection/
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.tld/.*$ [NC]
RewriteRule \.(gif|jpg|jpeg|png|js|css)$ - [NC,F,L]
Checking it out with altlab.com/htaccess_tutorial.html testing facility (near bottom of page ) shows no image if mydomain.tld/mypic.jpg is entered, while if prefixed with www (www.mydomain.tld/mypic.jpg) the pic is displayed.
Any helpful comments welcome.
© Server Fault or respective owner