|
2008-11-14, 01:43 AM | #1 |
You can now put whatever you want in this space :)
Join Date: Nov 2006
Location: Vulcan
Posts: 695
|
Anti Hotlinking
To stop hotlinking put the follwong code in my htaccess ,
RewriteEngine On RewriteCond %{HTTP_REFERER} !^http://(www\.)?fotopiccanti.it [NC] RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} ^http://.*$ RewriteRule \.(jpe?g|gif|bmp|png)$ - [F] What it ended up doing was block all images on my server , so if I made a freesite - the images that I hosted on my server would not appear, any idea why? |
2008-11-14, 05:21 AM | #2 |
You can now put whatever you want in this space :)
Join Date: Feb 2007
Location: Australia
Posts: 658
|
I'm not an expert in these matters - but I did have a similar problem a few years ago and used the code below... but if I remember when researching - it was a different syntax dependent upon the server setup:
Code:
RewriteEngine On RewriteCond %{HTTP_REFERER} ^http://(.+\.)?altlab\.com/ [NC] RewriteRule .*\.(jpe?g|gif|bmp|png)$ nohotlink.gif [L] |
2008-11-14, 06:29 AM | #3 |
Shift Out / X-On
|
what I have in my site:
## DISABLE HOTLINKING RewriteEngine on # Options +FollowSymlinks RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?aaaaa.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(www\.)?bbbbbbb.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(www\.)?cccccccc.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(www\.)?ddddddd.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(www\.)?eeeeee.net/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(www\.)?fffffff.com/.*$ [NC] RewriteRule \.(gif|jpg|jpeg|png|js|css)$ - [F] a,b,c,d,e,anf are exceptions |
2008-11-14, 11:17 AM | #5 | |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
Quote:
RewriteCond %{HTTP_REFERER} ^http://.*$ matches any request that has a referrer. So, if the referrer is not from your site, and it is not blank, and it comes from any site, block the image. Removing that one line will fix the problem.
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
|
2008-11-14, 01:25 PM | #6 |
You can now put whatever you want in this space :)
Join Date: Nov 2006
Location: Vulcan
Posts: 695
|
I tried that and still blocks my images - I only want to stop fotopicanti from linking to pics , but it seems like any requests get blocked
Should save on bandwidth though |
2008-11-14, 02:36 PM | #7 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
That rule is only allowing fotopiccanti.it to link your images, so, its the reverse of what you want.
There are two ways to do it. 1) block all hotlinking allowing your domain Code:
RewriteEngine On RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$ [NC] RewriteRule \.(jpe?g|gif|bmp|png)$ - [F] Code:
RewriteEngine on RewriteCond %{HTTP_REFERER} fotopiccanti.it [NC] RewriteRule .* - [F] Code:
RewriteEngine on # leave this line in allow empty referrers, remove to disallow empty referrers RewriteCond %{HTTP_REFERER} !^$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.*@)?([a-z0-9-]+\.)*yourdomain\.com(:[0-9]+)?(/.*)?$ [NC] RewriteRule .*\.(asf|mpg|mpeg|wmv|avi|rm|gif|jpe?g|png|zip)$ - [NC,F,L]
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
|
|