Picture hotlink protection not working

TazDevilLooney

Active member
I wonder if anyone can help me out here. I can't seem to get this hot linking to work. Is it because the picture file does not have the .png or . jpg on the end?

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(. \.)?mysite\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpe?g|gif|bmp|png|jpg)$ /NoHotlinking.png [L]

/attachments/malware-spreads-as-browser-update-2-jpg.1608/

Could someone give me a hand with this please. :cry:

The cheeky website is http://www.cnw.com.cn/security-anti-virus/htm2011/20110926_234622.shtml
 
Here is my .htaccess if that helps at all

Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?site.com [NC]
RewriteRule \.(jpg|jpeg|jpe|png|gif)$ http://link to image that is NOT ON YOUR SERVER.png [NC,R,L]
 
Here is my .htaccess if that helps at all

Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?site.com [NC]
RewriteRule \.(jpg|jpeg|jpe|png|gif)$ http://link to image that is NOT ON YOUR SERVER.png [NC,R,L]

Wow thanks Brett, I have added the code but the picture still displays on the website in question. I'm not sure what's going on :confused:

This is my current .htaccess

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data|js|styles|install) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
    Redirect 301 /forum http://fixitwizkid.com
</IfModule>
 
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?fixitwizkid.com [NC]
RewriteRule \.(jpg|jpeg|jpe|png|gif)$ http://fixitwizkid.com/NoHotlinking.png [NC,R,L]
 
Just an FYI, but generally any additional rewrite rules should be before the XenForo rewrite rules.

Try moving the code up to just below RewriteEngine On
 
I've tried a number of things but just can't get this to work for me. I did try all that was suggested. <sigh>

Code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?fixitwizkid.com [NC]
RewriteRule .*\.(jpeg|jpg|gif|bmp|png)$ http://mtcstorage.co.uk/NoHotlinking.png [L]

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data|js|styles|install) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
    Redirect 301 /forum http://fixitwizkid.com
</IfModule>

Hot Linked picture from the site.
mod3-png.862


This is the example picture i was hoping for everyone else to receive which is located on another server.
NoHotlinking.webp
I'm really scratching my head here any more idea's.

Thanks for all of the help guys and sorry for the late reply.
 
Try this:

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?fixitwizkid.com [NC]
    RewriteRule .*\.(jpeg|jpg|gif|bmp|png)$ http://mtcstorage.co.uk/NoHotlinking.png [L]

    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data|js|styles|install) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
    Redirect 301 /forum http://fixitwizkid.com
</IfModule>
 
Would the hot linking address be something to do with? /attachments/mod3-png.862/

Why i say that is it's not got the .png on the end.
 
Try this one:

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?fixitwizkid.com [NC]
    RewriteRule .*\.(jpeg.[0-9]|jpg.[0-9]|gif.[0-9]|bmp.[0-9]|png.[0-9])$ http://mtcstorage.co.uk/NoHotlinking.png [L]

    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data|js|styles|install) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
    Redirect 301 /forum http://fixitwizkid.com
</IfModule>

And this one although it may cause errors with other urls.

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?fixitwizkid.com [NC]
    RewriteRule .*\.(jpeg.*|jpg.*|gif.*|bmp.*|png.*)$ http://mtcstorage.co.uk/NoHotlinking.png [L]

    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data|js|styles|install) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
    Redirect 301 /forum http://fixitwizkid.com
</IfModule>
 
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?fixitwizkid.com [NC]
#    RewriteRule .*\.(jpeg.[0-9]|jpg.[0-9]|gif.[SIZE=14px][0-9]|bmp.[0-9]|png.[0-9])$ http://mtcstorage.co.uk/NoHotlinking.png [L]
  RewriteRule .*\.(jpeg.*|jpg.*|gif.*|bmp.*|png.*)$ http://mtcstorage.co.uk/NoHotlinking.png [L]

    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data|js|styles|install) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
    Redirect 301 /forum http://fixitwizkid.com
</IfModule>
 
Well the first one you have commented out has the
Code:
[SIZE=14px]
in it still.

And sorry I I dunno what else to do. But yes it has something to do with the numbers on the end and jpg etc. not being there.
 
Made the corrections and still the same. I definitely agree with you George with the numbers on the end. I can't see how everyone else's seems to work and mine don't. Can someone provide me some sort of prof that there's works with Xenforo attachments. At this moment i really can't see how it can. Thanks for all your help with this George you a star buddy.
 
Back
Top Bottom