#1 2025-05-12 20:10:12

Ralf
Member
Dorsten-Lembeck
2012-05-08
237

PHP Extension in Url

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


There are only two kinds of music:
Rock and Roll

https://www.ralf-kerkhoff.de

Offline

 

#2 2025-05-12 23:46:36

Ralf
Member
Dorsten-Lembeck
2012-05-08
237

Re: PHP Extension in Url

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


There are only two kinds of music:
Rock and Roll

https://www.ralf-kerkhoff.de

Offline

 

#3 2025-05-14 16:33:44

erAck
Only trying to help
2015-09-06
2222

Re: PHP Extension in Url

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.


Running Piwigo at https://erack.net/gallery/

Offline

 

#4 2025-05-14 19:16:49

Ralf
Member
Dorsten-Lembeck
2012-05-08
237

Re: PHP Extension in Url

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


There are only two kinds of music:
Rock and Roll

https://www.ralf-kerkhoff.de

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2025 · Contact