.htaccess hotlink help


#1

Heya,

I’m trying to set up my .htaccess to prevent hotlinking from all but a select few domains. I’ve managed to get it working for regular domains except livejournal (which I want to allow).

A line like this:
RewriteCond %{HTTP_REFERER} !^http://(www.)?example.livejournal.com/ [NC]
will allow the LJ user “example” to hotlink files, but I want to cover everything under livejournal.com at once, and not individual users all with their own RewriteCond line. If I simply have:
RewriteCond %{HTTP_REFERER} !^http://(www.)?livejournal.com/ [NC]
it doesn’t allow a page in the user.livejournal.com format to hotlink. I’m unsure of the syntax.

Any pointers?


#2

Mine says:

RewriteCond %{HTTP_REFERER} !^http://.*livejournal.com(/)?.*$ [NC]and it seems to be working okay. That was the only thing I could come up with to get my photos working over there again after they switched all the user accounts to subdomains.


#3

works perfectly! thank you very much!


#4

See the wiki for more information about this: Preventing image hotlinking


Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#5

I don’t think this example from the wiki works anymore, though:

RewriteCond %{HTTP_REFERER} !^http://(www\.)?livejournal\.com/ [NC]It’s what I used in the past (and I think what the original poster was using) but when Livejournal switched URL formats from www.livejournal.com/username/ to username.livejournal.com, it broke.

There’s probably a more elegant solution than mine, but that’s what I came up with. (If I’m not mistaken, mine would let someone with a domain like blahblahlivejournal.com to hotlink my images, but I figure but the likelihood of that is pretty remote.)


#6

Be aware these methods are trivially easy to defeat with Referer tools such as for Firefox https://addons.mozilla.org/search.php?q=referer&app=firefox, some firewall software, and similar tools for iE.


#7

Be aware that most “hotlinkers” haven’t got a clue how to do stuff like that, otherwise they wouldn’t be using things like EasySpace in the first place.


Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#8

[quote]Be aware that most “hotlinkers” haven’t got a clue how to do stuff like that, otherwise they wouldn’t be using things like EasySpace in the first place.

[/quote]

Be aware that Google is one of the biggest “hotlinkers,” and they’ve got clues.

Just because people choose other places and ways than you, doesn’t mean they are clueless. Let’s see. They’re having fun with discussions and showing friends pictures at virtually no cost, while you’re whining about “hotlinking” and bandwidth “theft.” Hmm. Yeah, they’ll never figure out how to install a plugin or firewall. Can’t imagine how they manage to “hotlink” in the first place.


#9

[quote]I don’t think this example from the wiki works anymore, though:

[/quote]

The guy who wrote and linked to the article in the wiki says his “understanding of regular expressions [is] little better than that of a stick of celery,” so he’ll probably have to get back to you on that.

Oh, and even if we wanted to correct the wiki, we couldn’t right now, because the guy whose understanding is little better than a stick of celery has blocked changes to the article.


#10

The block is only there because of the activities of Anonymous, who has taken it upon himself to spoil it for everyone. Once that user has returned to behaving properly, the block will be lifted. Even now, anyone with Sysop rating or better (Admin, Bureaucrat) can make changes.


Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#11

[quote]spoil it for everyone

[/quote]

spoil it meaning draw attention to opinions different than yours, without first getting your permission.

everyone meaning you.