Advanced hotlink protection

Hello.

I am looking for some solution to prevent image hotlinking. I had some commonly used .htaccess code for blocking hotlinking from all other sites except search engines.
If works nice but I found out that still I am losing lots of bandwidth (and visitors) because Google image search and also Bing allows users to open original image without opening page from site, so since Google introduced that option most searchers now do not even need to visit site, they can get full size image directly from image search.

I know that there is option to block search engines to crawl images from site (robots.txt, .htaccess), and some options to hide full resolution image inside ZenPhoto, but on site with public photos which should be indexed by search engines in full resolution it is not working (unless I an wrong).

So I was wondering is there any solution, some existing plugin or peace of code snippet for ZenPhoto (or something you could make) as solution.
I need something that will stop user to see original (or cached) version of image directly by entering it's URL or by following that image from image search engines and to redirect user to page with that particular image.

For example there is good solution here:
http://pixabay.com/en/blog/posts/hotlinking-protection-and-watermarking-for-google-32/

or for WordPress users:
http://wordpress.org/plugins/byrev-wp-picshield-hotlink-defence/

I hope you figure out what I am trying to accomplish.
Best regards.

Comments

  • acrylian Administrator, Developer
    Real hotlinking protection must be done on the server level using .htaccess. If someone links to a full or cached image from outside direclty Zenphoto is not involved at all and therefore naturally cannot do anything against that.
    http://www.zenphoto.org/news/site-protection
  • Jole Member
    Yes, you are right. I already have implemented .htaccess protection.

    For example I blocked all sites to load images from my site on their sites.

    Also, using HTTP_USER_AGENT I allowed main search engines to crawl images on site, but using HTTP_REFERER I blocked them (and not just search engines, all other sites) to directly load images, and I made redirection to home page if someone click on direct link to image.

    It works fine, but it is not ideal solution, user lands on home page instead of page with appropriate image.

    Is it possible to accomplish redirection to correct page with image on it?

    If you think you are able to do that please think about that, I am willing to pay reasonable price.

    Best regards.
  • Please note that it is not practical to use .htaccess to block the cache. This would require always rendering the image via PHP code. You can use the "obscure cachefile name" option to make guessing the link unlikely, though.

    .htaccess files are not able to do much computationally, so I doubt they could redirect to the image page. You could make a PHP plugin filter that does this, but again it is not simple since all you have is the link to the image in the cache and would have to derive the link to the image page.

    Personally, I would simply return a "forbidden" or "not found" response since obviously you consider such linkings improper.
  • Jole Member
    "Please note that it is not practical to use .htaccess to block the cache. This would require always rendering the image via PHP code. "

    I am not sure what are you thinking on? It works fine, even with static html cache plugin, and cached image is generated only on first view.

    I like how this site accomplished that, they even have explanation how to do that:
    http://pixabay.com/en/blog/posts/hotlinking-protection-and-watermarking-for-google-32/

    I wish that users from search engines land on right page instead on home page, but even landing on home page is better that opening image directly without even seeing site.

    Please take time to think about that, I know this is for paid support, and I am willing to pay if that could be accomplished.

    Best regards.
  • acrylian Administrator, Developer
    @sbillard: even our hotlinking htaccess has a line to exclude the own domain from the blocking.

    @Jole: If you block access via htaccess you need to redirect using it as well. You can do redirections via htaccess. Since you know the filename it should be possible to link to the image page itself. Just like our example hotlinking htaccess file does for the replacement image to be shown instead at the end.
  • Jole Member
    Do you think it is possible to make image hotlink protection and to redirect visitor to correct page with image on it?

    If you think that is possible can you help me?
Sign In or Register to comment.