HOTLINK Defence? HOTLINK Defence?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

HOTLINK Defence?

Started by terzo, June 20, 2013, 06:12:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

terzo

Hello first of all I want to appologize if there are the same topic as this one. I used serch form but I don't find anything like that I am looking for so I decide to make a new topic. Whatever...

How may you already know before a couple of months Google changed the way that they show results from Image searching. I make some modification over .htaccess which makes a reddirect to home page (index.php). Is there any possibility that redirect to be not to homepage but to page where is located middlesized thumbnail. For example:

If someone tries to open this image file: http://coppermine-gallery.net/demo/cpg15x/albums/userpics/10001/normal_papillon_bleu2_25k.jpg to be reddirected to http://coppermine-gallery.net/demo/cpg15x/displayimage.php?pid=4

There are a similar plugin in Wordpress named ByREV WP-PICShield - HOTLINK Defence and it works perfect. I am looking for plugin or some edits which gives the same effect.

Thank you!

Regards,
Miroslav Terziev

Niecher

#1
If Wordpress has the best plugin to protect against hotlinking, Coppermine Gallery should have something to protect the full-size images in addition to documents, music and videos.

In the example you mentioned, to capture the query_string and return to the page with the intermediate image is difficult.

Here's an htaccess file, only for coppermine gallery, as follows:


<Files ".htaccess">
Order Allow,Deny
Deny from All
</Files>

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -f

RewriteCond %{REQUEST_FILENAME} \.([Bb][Mm][Pp]|[Jj][Pp][Ee]?[Gg]|[Gg][Ii][Ff]|[Pp][Nn][Gg])$ [NC]

<FilesMatch "^(normal_(.*)|thumb_(.*)).([Bb][Mm][Pp]|[Jj][Pp][Ee]?[Gg]|[Gg][Ii][Ff]|[Pp][Nn][Gg])$">
RewriteCond %{HTTP_REFERER} !^$
</FilesMatch>

RewriteCond %{HTTP_REFERER} !^http(s)?://(.*)?example.com [NC]

RewriteCond %{REQUEST_URI} !^/example\.jpg$ [NC]

RewriteRule \.([Bb][Mm][Pp]|[Jj][Pp][Ee]?[Gg]|[Gg][Ii][Ff]|[Pp][Nn][Gg])$ http://example.com/example.jpg [R,NC,L]

RewriteCond %{REQUEST_FILENAME} -f

RewriteCond %{REQUEST_FILENAME} \.(7z|aac|arj|as(f|x)|avi|bz2|divx|docx?|f4(a|v)|flv|gtar|gz|lzh|m4(a|v)|midi?|mkv|mov(ie)|mp(2|3|4|e?g)|og(g|m)|pdf|qt|ra(m|r)|sw(c|f)|tar|tgz|wm(a|v)|zip)$ [NC]

RewriteCond %{HTTP_REFERER} !^$

RewriteCond %{HTTP_REFERER} !^http(s)?://(.*)?example.com [NC]

RewriteRule \.(7z|aac|arj|as(f|x)|avi|bz2|divx|docx?|f4(a|v)|flv|gtar|gz|lzh|m4(a|v)|midi?|mkv|mov(ie)|mp(2|3|4|e?g)|og(g|m)|pdf|qt|ra(m|r)|sw(c|f)|tar|tgz|wm(a|v)|zip)$ http://example.com/example.jpg [R,NC,L]




On the other hand, you can see that the intermediate images and thumbnails are not protected. This is necessary for google indexing these images and also allow sending images intermediate or thumbnails to your own forum or blog, facebook, google+, etc.

Documents, music and videos must allow blank referrer. You can add or remove file extensions as needed.

Note: To be used in the root folder. Do not forget to replace example.com with your domain and example.jpg your image to redirect.
This file should not give errors but if it happens just delete it.

Best Regards.

--Edit--
Added extensions case sensitive

phill104

You can restrict access to the fullsize images using this plugin here - http://forum.coppermine-gallery.net/index.php/topic,74870.0.html
It is a mistake to think you can solve any major problems just with potatoes.

Niecher

Thank you very much Phill.

Αndré

It should be possible to redirect to the corresponding intermediate-sized page. Instead of redirecting the user to the home page you should him redirect to a script that checks the visited file path against the database and redirect accordingly. I'm currently not sure if the script can access the visited path, as I never tested that before.

Αndré