Hi,
for many years i have used this settings to get some kind of clean/seo friendly urls.
1. Local files editor
$conf['question_mark_in_urls'] = true;
$conf['category_url_style'] = 'id-name';
$conf['picture_url_style'] = 'id-file';
$conf['original_url_protection'] = 'images';
$conf['derivative_url_style'] = 2;
$conf['php_extension_in_urls'] = true;
$conf['tag_url_style'] = 'tag';
2. .htaccess
AcceptPathInfo On
Options -Indexes +MultiViews
<Files "*.php">
MultiviewsMatch Any
</Files>
When doing so in Piwigo 14.5 or 15.5 everything is fine until I want to open/view a picture.
Instead of displaying the picture, the browser starts downloading the picture.php file.
Tested with Chrome, Firefox and Vivaldi.
Also switched from php 8.3 to 7.4 - which makes no difference.
Do i miss a setting in the htaccess file which Piwigo requires?
Cheers
Ralf
Offline
Did some deep diving and compared the picture.php with an older backup.
It seems that line 649 is causing the problem:
if ($conf['picture_download_icon'] and !empty($picture['current']['download_url']) and $user['enabled_high']=='true')
Changing this line to:
if ($conf['picture_download_icon'] and !empty($picture['current']['download_url']))
After the change and emptying the browser cache (!) urls work fine without php extension and without question mark.
As i do not use the download icon the change does probably have no impact to me - i guess.
Maybe some of the developers can have a look - it would be great to have the "pretty" urls without modifying a core file.
Cheers
Ralf
Offline
I have overridden
$conf['question_mark_in_urls'] = false;
$conf['php_extension_in_urls'] = false;
$conf['category_url_style'] = 'id-name';
$conf['tag_url_style'] = 'tag';
in local config and no such problem, Piwigo 15.5.0 PHP 8.1
But I also don't have the
<Files "*.php">
MultiviewsMatch Any
</Files>
in .htaccess, but quickly tried and there was no difference.
Note that the code you indicated is on line 639 not 649, so make sure you have the right picture.php file.
Also, with MultiviewsMatch Any the webserver may serve any matching file, even picture.php.orig or picture.php.bak if there are, make sure the actually expected picture.php is served.
Maybe interesting: https://stackoverflow.com/questions/163 … -in-apache both answers.
Offline
Hi erACK,
For Piwigo 14 it is indeed line 649 (there are some lines of hints regarding php 5 which are not there in Piwigo 15).
For Piwigo 15 its line 639.
What solved my problem was the hint with the multiple picture.php* files.
I indeed had some backups like picture.php.bak etc.
Everything is working fine again.
Thanks for saving my day!!
Ralf
Offline