Piwigo.org

You are not logged in. (Register / Login)

Announcement

Post a reply

Write your message and submit

Click in the dark area of the image to send your post.

Go back

Topic review (newest first)

mistic100
2012-05-21 12:34:41

plg wrote:

As described in post:127016, you should add:

Code:

<IfModule mod_rewrite.c>
...
</IfModule>

done

plg wrote:

Did you make sure that you didn't overwrite any existing .htaccess?

yes

plg
2012-05-21 12:27:21

Did you make sure that you didn't overwrite any existing .htaccess?

plg
2012-05-21 12:20:12

As described in post:127016, you should add:

Code:

<IfModule mod_rewrite.c>
...
</IfModule>
mistic100
2012-05-17 16:50:57

ok flop, let's do that

plg wrote:

1) the hotlink on the "web size" becomes a hotlink on the original
2) the hotlink on the HD no longer works
3) the hotlink on the thumbnail no longer works

as finally the file is generated by PHP here is a proposal which solves all three points (this is a part of the PHP script)

Code:

## redirect <2.4 thumbnails hotlinks to i.php
RewriteRule ^upload/(.*)/'.preg_quote($conf['dir_thumbnail']).'/'.preg_quote($conf['prefix_thumbnail']).'(.*)\.([a-z0-9]{3,4})$ i.php?/upload/$1/$2-th.$3 [L]
RewriteRule ^galleries/(.*)/'.preg_quote($conf['dir_thumbnail']).'/'.preg_quote($conf['prefix_thumbnail']).'(.*)\.([a-z0-9]{3,4})$ i.php?/galleries/$1/$2-th.$3 [L]

## redirect <2.4 high-def hotlinks to original file
RewriteRule ^upload/(.*)/pwg_high/(.*)\.([a-z0-9]{3,4})$ upload/$1/$2.$3 [L]
RewriteRule ^galleries/(.*)/pwg_high/(.*)\.([a-z0-9]{3,4})$ galleries/$1/$2.$3 [L]

## redirect <2.4 low-def hotlinks to i.php
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?'.preg_quote($_SERVER['SERVER_NAME']).'/.*$ [NC]
RewriteRule ^upload/(.*)/(.*)\.([a-z0-9]{3,4})$ i.php?/upload/$1/$2-me.$3 [L]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?'.preg_quote($_SERVER['SERVER_NAME']).'/.*$ [NC]
RewriteRule ^galleries(.*)/(.*)\.([a-z0-9]{3,4})$ i.php?/galleries/$1/$2-me.$3 [L]

I know, hard to read :)

flop25
2012-05-17 12:04:19

are you sure ? I read that most hosts don't authorize PHP to modify htaccess files for obvious security reasons

I've got a cache plugin on my WP install and it has modified the htaccess. I'm not aware of such limitation, but we can provide the 2 way : trying to auto install the htaccess, and if it can't, piwigo provide a code to copy/paste and a file to download/upload with the right parameters $conf['prefix_thumbnail'] and $conf['dir_thumbnail']

mistic100
2012-05-17 11:59:55

flop25 wrote:

a RewriteRule too with a condition on the referrer : it redirect to a page which display the picture needed but with a size XL and register the referrer

I don't really think it's a good idea : for big and famous galleries there well be tons of referrers, impossible for the webmaster to contact them all

actually

Eric wrote:

Assuming the issue impacts only hotlinks after upgrade to 2.4, htaccess file can't be distributed "as is" and set automatically.

I don't understand the problem... if there are no hotlinks these rewrite rules won't never be used


flop25 wrote:

for conf issue : htaccess can be created/append dynamically by piwigo

are you sure ? I read that most hosts don't authorize PHP to modify htaccess files for obvious security reasons

flop25
2012-05-17 11:50:34

mistic100 wrote:

well as http requests don't go throught Piwigo but directly to the file system I can't figure out how to detect it

a RewriteRule too with a condition on the referrer : it redirect to a page which display the picture needed but with a size XL and register the referrer

for conf issue : htaccess can be created/append dynamically by piwigo

Eric
2012-05-17 11:46:53

Of course, you're right. I think it was a little bit too late, yesterday evening, for my brain to work correctly ;-)

Anyway, in this case, hotlinks or not hotlinks do not matter : We can add the warning message and the way to add the right code in htaccess file for anybody who upgrade Piwigo to version 2.4. Adding the code in htaccess should not be mandatory but webmasters will be explicitly warned about the effects before upgrade.

mistic100
2012-05-17 00:20:30

well as http requests don't go throught Piwigo but directly to the file system I can't figure out how to detect it

Eric
2012-05-17 00:09:26

My 50 cents:

Assuming the issue impacts only hotlinks after upgrade to 2.4, htaccess file can't be distributed "as is" and set automatically. Is there any possibility to detect if hotlinks are set before upgrade?

If yes, maybe can we provide a warning message before upgrade to inform the webmasters they have to add the given rewrite rules in the htaccess file?

mistic100
2012-05-16 23:12:03

here is what I have for now

Code:

RewriteEngine on

## redirect <2.4 thumbnails hotlinks to i.php
RewriteRule ^upload/(.*)/thumbnail/(?:TN-)?(.*)\.([a-z0-9]{3,4})$ i.php?/upload/$1/$2-th.$3 [L]
RewriteRule ^galleries/(.*)/thumbnail/(?:TN-)?(.*)\.([a-z0-9]{3,4})$ i.php?/galleries/$1/$2-th.$3 [L]

## redirect <2.4 high-def hotlinks to original file
RewriteRule ^upload/(.*)/pwg_high/(.*)\.([a-z0-9]{3,4})$ upload/$1/$2.$3 [L]
RewriteRule ^galleries/(.*)/pwg_high/(.*)\.([a-z0-9]{3,4})$ galleries/$1/$2.$3 [L]

the only two problems I think can come from $conf['prefix_thumbnail'] and $conf['dir_thumbnail']
assuming that very few people change that we can provide the htaccess "as it" and give information and support to change if needed

anyway the question is how distribute the file ? some users have already a htaccess file, and it's rare that the server have permission to edit it himself

mistic100
2012-05-15 19:05:30

rvelices can you give an standard url to i.php with these two parameters : picture id (or picture path ?) and type (original/thumbnail) ?
I cant' find one in Piwigo sources

well... actually is it possible to direct link i.php ?

flop25
2012-05-08 11:53:08

Maybe a Rewrite to page which will store the referrer and display the picture XL
an admin page will list the referrer and for each the old url and the new one to replace. with explicative text to explain why such an intervention is needed
Because it seems impossible to do something automatic

plg
2012-05-08 00:10:41

Let's remind the 3 issues: after upgrading to Piwigo 2.4,

1) the hotlink on the "web size" becomes a hotlink on the original
2) the hotlink on the HD no longer works
3) the hotlink on the thumbnail no longer works

After discussing with mistic100 (and this is also what suggests rvelices earlier in this discussion), URL rewriting is a solution for 2 and 3:

RewriteRule ^(upload/.*/TN-.*.jpg)$ redirect.php?path=$1&type=thumbnail [L]
RewriteRule ^(upload/.*/pwg_high/.*.jpg)$ redirect.php?path=$1&type=original [L]

The question is still opened for problem #1.

plg
2012-05-07 22:40:19

This issue is still very disturbing for me. I don't know how to deal with it :-/

Board footer

Powered by FluxBB

About this website · Donate · Contact Piwigo project © 2002-2013