This is an old revision of the document!


Piwigo 2.4 introduces the feature multizise, this includes many technical changes, especially in the filesystem :

Before 2.4 teh filesystem looked like this :

+--Album
  +--pwg_high
  | |-mg_3663.png
  | |-mg_3664.png
  | \-mg_3665.png
  +--thumbnail
  | |-TN-mg_3663.png
  | |-TN-mg_3664.png
  | \-TN-mg_3665.png
  |--mg_3663.png
  |--mg_3664.png
  \--mg_3665.png

Now in 2.4 we keep only one version of each photo (the original file) :

+--Album
  |--mg_3663.png
  |--mg_3664.png
  \--mg_3665.png

The direct consequences are :

  • the hotlink on the “web size” becomes a hotlink on the original
  • the hotlink on the HD no longer works
  • the hotlink on the thumbnail no longer works

To solve this issue Piwigo tries to create or modify the .htaccess file on the root of your installation. This file contains some url rewrite rules informing your host that links to pictures had changed.

If for some reason Piwigo can't create or modify the file you will have to edit it manually. Before do that think if you need it : if you are sure nobody hotlinks your pictures you can just ignore the following steps.

Default .htaccess :

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]

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

TODO : explanations

 
Back to top
user_documentation/use/features/new/htaccess_and_hotlink_in_2.4.1337345487.txt.gz · Last modified: 2012/05/18 12:51 by mistic100
 
 
github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact