"bug" in the .htaccess file

armitch

Joined: 2004-01-19
Posts: 1
Posted: Mon, 2004-01-19 06:49

Gallery appears to have a problem when an album name contains a "." (full-stop or dot).
(in my site (before I hacked the .htaccess) the "recent" album has a subalbum named "04.01.13", click on it and you got a 404.

I think that the problem is in the .htaccess of gallery...
RewriteRule ^([^\.\?/]+)$ /view_album.php?set_albumName=$1 [QSA]
is the rewrite rule that appears relevant... it only rewrites files without a dot so that, for example, index.php does not get redirected (fair enough), also no files containing "/" or ? get redirected.

Perhaps we should change it so that only files containing .php or / don't get redirected?

I've hacked the .htaccess, to replace the problem line with the following...
RewriteCond $1 !\.php
RewriteCond $1 !\.htm
RewriteRule ^([^\?/]+)$ /view_album.php?set_albumName=$1 [QSA]

Which basically means that files with none of ? or / or .php or .htm get redirected
instead of files with none of ? or / or .
I allowed for .html incase someone put a .htm or .html file in that directory (currently onlt .php)

Should this solution work and is it worth changing the gallery release? I think it could only break someone's install if they have a .something file (not php,htm,php3,html) which they do not want redirected... would anyone have that?
Of course if someone chooses to have an album ending in .html or .php then that's their problem!

alternatively when created or inserted with pictures, any album containing "." could be converted into, say, _.
any thoughts?
----
Give us your Gallery/webserver information to get a faster answer.
Get this information from the PHP diagnostic (in the configuration wizard).
Gallery URL (optional but very useful): gallery.andrewmitchell.id.au
Gallery version: 1.4.1
Apache version: 2.048(Fedora)
PHP version (don't just say PHP 4, please): 4.3.4
Graphics Toolkit:
Operating system: linux/Fedora core 1
Web browser/version (if applicable):

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Wed, 2004-01-21 19:02

Hrm. I didn't think of that when I did the mod_rewrite code (obviously :-) ). This looks like bug to me and your solution looks pretty reasonable. Would you please file this as a bug at http://sf.net/projects/gallery with the details above? Thanks!