Htaccess hotlinker question

Associate
Joined
10 Mar 2006
Posts
393
Ok this is how you block a hotlinker:
Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ - [F]

But my question is what do I need to add to allow multiple domains?


Do I just repeat the
Code:
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain.com/.*$ [NC]
line for every domain I want to allow access to?

Thanks!!
 
Yes, that's correct.

You can specify multiple hosts/variations on a single line to keep it concise if you wish, such as:
Code:
RewriteCond %{HTTP_REFERER} !^http://(forums.|www.)?website(.co.uk|.com)/ [NC]
The pipe being a logical OR.
 
Back
Top Bottom