sts Posted March 5, 2004 Posted March 5, 2004 is it correct to write RewriteCond %{HTTP_REFERER} !^http://(www\.)?yoursite.com/.*$ [NC] instead of RewriteCond %{HTTP_REFERER} !^http://www.yoursite.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://yoursite.com/.*$ [NC] Quote
MikeJ Posted March 5, 2004 Posted March 5, 2004 Yes. But if you want to cover the cases without the trailing slash as well: >RewriteCond %{HTTP_REFERER} !^http://(www\.)?yoursite.com(/)?.*$ [NC] Quote
sts Posted March 10, 2004 Author Posted March 10, 2004 I tried the code above and that elegant line you suggested in another thread >RewriteCond %{HTTP_REFERER} !^http://(.*\.)?yoursite.com(/)?.*$ [NC] And it doesn't work sometimes, I mean I've seen requests for hotlink.png and referer was my domain. I don't know why Is it OK to edit .htaccess with file manager's Edit File, btw? So, I switched back to the code cpanel generates, it seems to work all the times... but not for everyone. We have 2 computers - normal and weird On normal one hotlink protection works, on weird one it doesn't: If I forbid direct requests I can't see any images on my own page. Btw, I can't see some family members' images, Virtual Imager's for example. If I allow direct requests I can see all images including hotlinked ones. I mean if I go to a page hotlinking my images I see the original images, but not hotlink.pngs As I understand it happens because on the weird computer browsers don't send Referer HTTP header [or something ] The reason I'm so into it is that I had annoying case of hotlinking from one subdomain, which ate ~0.7GB last month, so I decided to do something about it. The hotlink protection was enabled, but it didn't bother them. Using a nastier hotlink.png seems to be helping but innocent people can suffer too, like those ones who translate your pages Is it possible to redirect everyone to hotlink.png and badsite.com users to nastyhotlink.png? Quote
MikeJ Posted March 12, 2004 Posted March 12, 2004 As I understand it happens because on the weird computer browsers don't send Referer HTTP header [or something ] Yes. There are some (small amount of) browsers that may not send referrer information. Is it possible to redirect everyone to hotlink.pngand badsite.com users to nastyhotlink.png? Quite honestly, if bandwidth is an issue, you'd be better off just selecting not to redirect them to another image, instead just deny access. Then there is virtually no bandwidth used up on your end, and they'll just get a broken image on their page. Redirecting them to an anti-hotlinking image will still eat up your bandwidth if they don't remove the hotlink. That can all be done in the cpanel hotlinking settings. Quote
sts Posted March 12, 2004 Author Posted March 12, 2004 Ah, I almost forgot you can just deny access Will do next time. Thanks! In that particular case redirecting them to anti-hotlinking image was the only way to send them a message.. well, at least the only way I could find cafe.naver.com Quote
DarqFlare Posted March 12, 2004 Posted March 12, 2004 (edited) Mike and I have been having a big discussion about image hotlink protection in the CPanel and Site Maintenance forum... Go ahead and check it out if you get the chance. http://www.totalchoicehosting.com/forums/i...?showtopic=8111 Edited March 12, 2004 by TCH-Robert Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.