forum.coppermine-gallery.net

No Support => Feature requests => Topic started by: JensBman on December 27, 2004, 08:29:31 pm

Title: Nice urls with Apache's mod_rewrite
Post by: JensBman on December 27, 2004, 08:29:31 pm
Hi!

I saw one or two request of this but there were from like 2002-2003 so I thought its time to take it up again. The only problem I have with cpg right now is the url's. Its much nicer to tell a friend to go to www.backeman.se/gallery/miniscour04 than www.backeman.se/gallery/thumbnails.php?album=10, and url that they will never remember.

Im not sure how big trouble it is to implement it but I have seen a few very small gallerys have it so... Well, I just hope you will implement it soon.

Keep up the good work!!

Best regards,
Jenz
Title: Re: Nice urls with Apache's mod_rewrite
Post by: Tranz on December 27, 2004, 08:38:04 pm
I think the reason we can't do this is that not everyone has mod_rewrite access. It's nice to use such a URL but impractical when dealing with database-driven items at the scale that cpg does it. Who verbally tells people URLs that often anyway. People usually tell URLs via email/IMs.
Title: Re: Nice urls with Apache's mod_rewrite
Post by: Joachim Müller on December 28, 2004, 05:43:55 am
TranzNDance is right (as always): putting this into coppermine's core code would result in coppermine not working for users on IIS and webhosting without mod_rewrite. I can see litlle point in narrowing down the number of users coppermine can have for the sake of just a nice-to-have feature. However, there are postings on mod_rewrite with coppermine on the mods board.
In other words: your request is turned down; you're recommended to use the mod instead.

Joachim
Title: Re: Nice urls with Apache's mod_rewrite
Post by: JensBman on December 28, 2004, 01:25:48 pm
Ahh, found it. Thanks!

Well, I agree with one fellow that said something about autodetection and so on but I can understand the reasons why you don't want to implement it.

I'll try the mod. Thanks for your help!

/Jenz
Title: Re: Nice urls with Apache's mod_rewrite
Post by: partypics on January 09, 2005, 12:21:03 am
First of all I would like to thank the CPG developers community for such a great software!
I have read this thread http://forum.coppermine-gallery.net/index.php?topic=69.0 and done the modifications posted by Oasis to make nice url's to users galleries - and it worked fine in CPG 1.3.2
Just wanted to add my little improvement:
in original code a url like www.somesite.com/someuser
would work fine, but a url like www.somesite.com/someuser/ (with an ending "/") would fail.
To correct this you can add a line in .htaccess, redirecting www.somesite.com/someuser/ to www.somesite.com/someuser before other lines.
I used this regexp and it worked fine:
Code: [Select]
RedirectMatch ^/([a-z0-9&_=]+)/$ /$1
The second step, I think, is to make url's look like this:
www.somesite.com/someuser/album_name to point to a specific album. Users would love it.
I thought, that a redirect like
Code: [Select]
RedirectMatch ^/([a-z0-9&_=]+)/([a-z0-9&_=]+)$ /thumbnails.php?album=$2would work, but it does not in Apache 1.* because "?" is translated into "%3f" and you can't pass arguments to a redirected script. It seems to be an Apache bug, which have been fixed in Apache 2 (not sure about it though, read somewhere else).
RewriteRule works with this regexp, but not entirely suitable:
you are actually on www.somesite.com/someuser/thumbnails.php, not www.somesite.com/thumbnails.php and links dont work, css and images don't load correctly, etc.

Anyone has done it before? Any ideas would be very appreciated. Thanks.

 

PS
Sorry, it looks like I chose the wrong place for my post, please move it to appropriate topic  ::)