PDA

View Full Version : Allowing a domain to hotlink you


RedCherry
2006-06-16, 01:55 PM
Ok, just used the .htaccess in the FAQ section, and stopped some hotlinkers. :D But I have one domain that I use for picposts, so I want to allow some domains to hotlink me. How do I modify that .htacess to allow that?

this is what I have

ErrorDocument 404 http://www.mydomain.com/404.shtml
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(.*@)?([a-z0-9-]+\.)*mydomain\.com(:[0-9]+)?(/.*)?$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.*@)?1\.2\.3\.4(:[0-9]+)?(/.*)?$
RewriteRule .*\.(asf|mpg|mpeg|wmv|avi|rm|gif|jpeg|jpg|zip)$ - [NC,F,L]


how do I add in domains to that that are ok to hotlink?

cd34
2006-06-16, 02:27 PM
RewriteCond %{HTTP_REFERER} !^http://(.*@)?([a-z0-9-]+\.)*otherdomain\.com(:[0-9]+)?(/.*)?$ [NC]

add as many of these as you need above the RewriteRule line with the domains that you want to allow

Jensen
2006-06-16, 02:42 PM
when I have questions like that, I just call BrianH at webair... easy :)

RedCherry
2006-06-16, 02:56 PM
Thanks sparky! :)

RewriteCond %{HTTP_REFERER} !^http://(.*@)?([a-z0-9-]+\.)*otherdomain\.com(:[0-9]+)?(/.*)?$ [NC]

add as many of these as you need above the RewriteRule line with the domains that you want to allow

RedCherry
2006-06-18, 11:22 AM
Thought I'd pass this along, Mike at Phatservers sent me this. :) The .htaccess generator that is posted in other threads was 404, one of the reasons I started this thread, and this is another good generator.

http://www.htmlbasix.com/disablehotlinking.shtml

juggernaut
2006-06-19, 04:58 PM
Yeah I know that place I use has been 404 alot latly. Heres another one, I love the huge amount of options. Most generators do standard, username password, bot blocking etc. This is nice

http://cooletips.de/htaccess/

upallnite
2006-06-21, 05:32 AM
Hi RedCherry
Can you show me a movie file that you have protectd with this:

ErrorDocument 404 http://www.mydomain.com/404.shtml
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(.*@)?([a-z0-9-]+\.)*mydomain\.com(:[0-9]+)?(/.*)?$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.*@)?1\.2\.3\.4(:[0-9]+)?(/.*)?$
RewriteRule .*\.(asf|mpg|mpeg|wmv|avi|rm|gif|jpeg|jpg|zip)$ - [NC,F,L]

If anyone has any type of movie file protected with htaccess I would like to try our test on it.