Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

modifying .htaccess to deny hotlinking

Options
  • 06-10-2005 4:40pm
    #1
    Registered Users Posts: 1,169 ✭✭✭


    I've been meaningd to stop people hotlinking images on tcal because they're sucking bandwidth. Now I'm finally doing it. I've read various tutorials and implemented this code in my .htaccess file:
    RewriteCond %{HTTP_REFERER} !^http://www.tcal.net/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://tcal.net/.*$ [NC] 
    RewriteRule \.(jpe?g|gif|bmp|png)$ /uploads/imageblock.jpe [L]
    

    This works. But where I'm coming up with problems is allowing one directory to be hotlinked so I can let people hotlink TCAL link images, such as the one that is in my signature. (At the moment it's broken as you can see.) This tutorial here says all I need to do is in the sigpic directory on tcal put a new .htaccess in with the following:
    RewriteEngine on
    RewriteRule ^.*$ -
    

    I did this and it seems nothing can be accessed from there now [hence the sigpic appearing blank.

    Does anyone have any tips? I'm reading loads of tutorials on it but can't seem to find the answer.


Comments

  • Registered Users Posts: 2,157 ✭✭✭Serbian


    Maybe you could try overriding the referrer condition too?
    RewriteEngine on
    RewriteCond    %{HTTP_REFERER} ^.*$
    RewriteRule ^.*$ -
    


  • Registered Users Posts: 1,169 ✭✭✭dangerman


    Bleh, there was no problem with the code.

    In order for the php code based png graphic to load, you have to add
    ForceType application/x-httpd-php
    

    to the .htaccess. Of course I come along with my new .htaccess to allow the sigpic directory to be seen, and overwrite the above so the sig pic stops working. :o

    Cheers for the help anyway Serbian!


Advertisement