hot linking htaccess question

A blond question, regarding allowing certain domains to access images from another domain.

When you have several domains, some with sub domains, do you include those sub domains in the htaccess file for ‘accepted domains’? or does just having the main domain cover it?


RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com(/)?.*$  [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?subdomain.mydomain.com(/)?.*$  [NC]

Should the sub be included or not?

Re: hot linking htaccess question

This is what I use for my free sites, it works by only allowing access to JPG/GIFs from the domains listed:

RewriteCond %{REQUEST_FILENAME} .*jpg$|.*gif$|.*png$ [NC]
RewriteCond %{HTTP_REFERER} !^$ 
RewriteCond %{HTTP_REFERER} !pornisation\.com [NC] 
RewriteCond %{HTTP_REFERER} !gaydemon\.com [NC]  
RewriteCond %{HTTP_REFERER} !gayadulthost\.com [NC]  
RewriteCond %{HTTP_REFERER} !google\. [NC] 
RewriteCond %{HTTP_REFERER} !flickr\.com [NC] 
RewriteCond %{HTTP_REFERER} !yahoo\. [NC] 
RewriteRule .*\.(gif|jpg|png)$ hotlinked.png [L]

Re: hot linking htaccess question

Thanks Bjorn, but what I am trying to see, is if I have images on mydomain1.com and want them to be accessed (hotlinked to) by my other sites, that say are on mydomain2.com and mydomain3.com, but also the sub domains on them, do I need to include the subdomain as well in the ‘allowed’ list.

so while my hotlink has mydomain2.com do I also need to include the sub domains such as sub1.mydomain2.com or does just having mydomain2.com allow hotlinking from sub1.mydomain2.com to mydomain1.com?

Man I need another coffee, that has my head spinning lol

Re: hot linking htaccess question

[QUOTE=Gaystoryman;79181]Thanks Bjorn, but what I am trying to see, is if I have images on mydomain1.com and want them to be accessed (hotlinked to) by my other sites, that say are on mydomain2.com and mydomain3.com, but also the sub domains on them, do I need to include the subdomain as well in the ‘allowed’ list.

so while my hotlink has mydomain2.com do I also need to include the sub domains such as sub1.mydomain2.com or does just having mydomain2.com allow hotlinking from sub1.mydomain2.com to mydomain1.com?

Man I need another coffee, that has my head spinning lol[/QUOTE]

I don’t think you need to include the sub-domain, the rules will allow any traffic from the domain or it’s sub-domains.