Forum Moderators: phranque

Message Too Old, No Replies

Block hotlinking except two domains

How do I do it?

         

felixior

9:17 am on Mar 15, 2008 (gmt 0)

10+ Year Member



I want to secure a directory with htaccess so that only the website itself can use the files in it. But one other domein uses the directory as well, so the regular anti-hotlinking htaccess won't do.

How can I secure a directory against hotlinking EXCEPT its own domain AND one other domain?

wilderness

2:15 am on Mar 16, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Simply add the second domain to anti-hotlinking rewrite by adding an additional line.

felixior

11:56 am on Mar 16, 2008 (gmt 0)

10+ Year Member



Thanks, I found out myself as well that it is plain simple:

RewriteCond %{HTTP_REFERER} !^http://www.domain1.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domain2.com.*$ [NC]