Can't get hotlink protection to work

Hi, I'm having trouble getting hotlink to work. I'm using Zenphoto 1.4.1.2 and haven't customised my htaccess file other than to try adding the recommended hotlink protection code. I've tested it and the protection doesn't work. Even when I tried using my cPanel hotlink protection that doesn't work and produced the following error message:

Apache detected an error in the Rewrite config. httpd: Syntax error on line 99 of /home/********/public_html/.htaccess.10h5XMMTPNzuayDlHNqNEdYtqOr8U5a3: RewriteCond without matching RewriteCond section Please try again.

The htaccess file is working correctly as far as URL rewriting goes and I've used hotlink protection before on other sites so I ought to be able get this to work.

Any ideas?

Thanks.

Comments

  • acrylian Administrator, Developer
    I have no idea what "0h5XMMTPNzuayDlHNqNEdYtqOr8U5a3" means..

    We have an preprepared htaccess file for this purpose:
    http://www.zenphoto.org/news/how-to-protect-my-images-from-hotlinking-

    Note that you need to put that into the /albums folder and possibly the /cache folder as well. It may be that your server configuration does not work with it. You have to try.
  • Oh dear, my apologies for wasting your time, I was being an idiot and only thinking of the main htaccess file. Now I've put one in the albums folder it works as expected.

    I'll put it down to stress - I'm getting married next week.
  • vincent3569 Member, Translator
    @ajkphoto : congratulations !

    @acrylian : I am trying to use the .htaccess for hotlink protection.

    the code of my .htaccess looks like :
    `

    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mydomain.com [NC]
    RewriteRule \.(jpg|jpeg|png|gif|flv|mp4|mov|3gp)$ http://www.mydomain.com/myimage.jpg [NC,F,L]

    `
    the hotlinking protection is OK (the images of my /albums directory are not displayed), but the replacement image is not displayed.

    any idea about that ?
  • acrylian Administrator, Developer
    Why don't you try our predefined one? That did work and applies only for the full images in /albums where it needs to be placed.

    Strange is that even without for some reason on my live install default replacement images never show (even without protection). I could not solve that, probably related to some server setting.
  • vincent3569 Member, Translator
    Hi

    I use yours, but I have cleaned it (supress comment lines).

    You are explain that the rewrite rule to display a remplacement image doesn't work for you too ?

    Strange, after some research on the net, the syntax seems to be correct.

    I will ask to my hoster...
  • acrylian Administrator, Developer
    The htaccess file is take from online resources naturally.

    Sorry, I mixed up and was referring to the multimedia default images actually, those are fetched from /zp-core and do not work for me on my lve install for some strange server settings.

    I have to retry the hotlinking protection images. As mentioned on some servers blocking access to /albums using the htaccess might block Zenphoto in general. Not the easiest matter.
Sign In or Register to comment.