•  » Engine
  •  » [multisize] hotlinks and upgrade

#16 2012-05-17 16:50:57

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: [multisize] hotlinks and upgrade

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 :)

Offline

 

#17 2012-05-21 12:20:12

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
14048

Re: [multisize] hotlinks and upgrade

As described in [Forum, post 127016 by rvelices in topic 18648] [2.4] multiple size / original - protection of urls, you should add:

Code:

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

Offline

 

#18 2012-05-21 12:27:21

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
14048

Re: [multisize] hotlinks and upgrade

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

Offline

 

#19 2012-05-21 12:34:41

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: [multisize] hotlinks and upgrade

plg wrote:

As described in [Forum, post 127016 by rvelices in topic 18648] [2.4] multiple size / original - protection of urls, 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

Offline

 
  •  » Engine
  •  » [multisize] hotlinks and upgrade

Board footer

Powered by FluxBB

github linkedin newsletter Piwigo.org © 2002-2026 · Contact