rewrite not working properly?

robinbowes

Joined: 2002-09-20
Posts: 99
Posted: Sat, 2002-09-28 07:26

Hi,

I've got (minor) problems using mod_rewrite with gallery. I'm not sure that gallery is working as I would expect it to (or I may be wrong!)

At first, I had the trailing slash problem (as described here: http://gallery.menalto.com/modules.php?op=modload&name=phpBB_14&file=index&action=viewtopic&topic=411&6) which meant that rewriting was not detected by the configuration wizard. Changing the alias in httpd.conf fixed it:

Alias /gallery /var/www/robinbowes.com/gallery
<Directory /var/www/robinbowes.com/gallery>
RewriteEngine on
AllowOverride Options FileInfo
</Directory>

I've re-run the configuration and re-write is now detected to be working correctly. I can use URLs in the form: http://robinbowes.com/gallery/Family-photos instead of http://robinbowes.com/gallery/view_album.php?set_albumName=Family-photos.

However, and this is what I perceive to be the problem, Gallery is still generating links in the latter format, e.g. if I log in as Admin and go to the top level (http://robinbowes.com/gallery) the URL listed for the Family-photos album is http://robinbowes.com/gallery/view_album.php?set_albumName=Family-photos. rather than http://robinbowes.com/gallery/Family-photos .

Is this normal behaviour, or am I correct to expect Gallery to generate urls in the short format when re-writing is enabled?

Thanks,

Robin

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Mon, 2002-09-30 03:01

I tried to check this out, but your entire site is reporting:

Quote:
Template Error: set_root: /var/www/robinbowes.com/geeklog/public_html/layout/Smooth Blue/ is not a directory.
Halted.

Let us know when that's fixed and we'll check out your rewrite problem.

 
robinbowes

Joined: 2002-09-20
Posts: 99
Posted: Tue, 2002-10-01 23:15

Aha,

You must have caught me mid-reconfiguration! :smile:

It should be OK now.

Thanks for looking.

R.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Fri, 2002-10-04 18:18

I just tried again and am still getting the same exact error. Perhaps it's because I'm not logged in to your site and am using a layout that you don't have installed?

 
robinbowes

Joined: 2002-09-20
Posts: 99
Posted: Sun, 2002-10-06 07:28

Hi again,

I *think* I've found the problem, and you're right, it was related to you not being logged in and a typo in my default theme.

It really should work now!

Cheers,

R.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Mon, 2002-10-07 00:10

Ah, ok the site works now. So, the key thing is that you're using the Geeklog mod. I'm not familiar with how that mod works, so I don't know whether it is going to interoperate properly with the URL rewrite code. This is probably one for the guys who wrote the Geeklog patch.

I see that your site is working properly at the moment, but it looks like you've got rewriting turned off.

 
robinbowes

Joined: 2002-09-20
Posts: 99
Posted: Thu, 2002-10-10 13:45

Hi,

Quote:
Ah, ok the site works now. So, the key thing is that you're using the Geeklog mod. I'm not familiar with how that mod works, so I don't know whether it is going to interoperate properly with the URL rewrite code. This is probably one for the guys who wrote the Geeklog patch.

The geeklog patch works in a similar fashion to the other "wrapped by" code. I don't *think* the rewrite code should be affected by being wrapped in geeklog, but I can't say for sure.

Quote:
I see that your site is working properly at the moment, but it looks like you've got rewriting turned off.

That's the problem! It's actually turned on. e.g. if you access http://robinbowes.com/gallery/Family-Album, it opens the album named "Family-Album".

However, the links generated use the verbose URL, e.g. http://robinbowes.com/gallery/view_album.php?set_albumName=Family-Album

(see my original post)

Any idea why this should be?

R.

 
alindeman
alindeman's picture

Joined: 2002-10-06
Posts: 8194
Posted: Thu, 2002-10-10 15:18

Make sure in config.php the following directive is set to 1

$gallery->app->feature["rewrite"] = 1;

Gallery should then generate URLs that use mod_rewrite...

 
robinbowes

Joined: 2002-09-20
Posts: 99
Posted: Thu, 2002-10-10 21:39
Quote:
Make sure in config.php the following directive is set to 1

$gallery->app->feature["rewrite"] = 1;

Gallery should then generate URLs that use mod_rewrite...

I checked that - it is.

Following Bharat's mention of the geeklog embedding, I tried disabling the geeklog embedding code (i.e. just commenting the $GALLERY_EMBEDDED_INSIDE = "geeklog"; line in config.php.).

Guess what... re-writing works when gallery is not embedded inside geeklog.

So, it looks like it's a problem with the geeklog/gallery integration.

At least I've got something to go on now!

Cheers,

R.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Fri, 2002-10-11 18:09

The problem is that rewrite is on. So turn it off in your config.php:

$gallery->app->feature["rewrite"] = 0;

then Gallery will generate the long URLs and should work with Geeklog.

 
robinbowes

Joined: 2002-09-20
Posts: 99
Posted: Mon, 2002-10-21 14:24
Quote:
The problem is that rewrite is on. So turn it off in your config.php:

$gallery->app->feature["rewrite"] = 0;

then Gallery will generate the long URLs and should work with Geeklog.

Bharat,

I'm not sure you're quite understanding the problem.

Gallery is generating long URLs and is working with Geeklog, even with rewrite turned on.

Short URLs work fine, but Gallery is not generating them when embedded within Geeklog.

If I turn off the embedding, the short URLs are generated correctly.

Any idea why Gallery should think that rewrite is "Off" when embedded within Geeklog?

R.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Tue, 2002-10-22 20:45

Ah, I understand now.

The problem is that Gallery disables short URLs whenever it is embedded in anything. This is because I had a *Nuke bias when I wrote that code and Nuke prevents us from using short URLs. The folks who do the geeklog patch could remove this restriction in their next rev of the patch... Or you could modify the makeAlbumUrl() function in util.php:

change:
if (!$GALLERY_EMBEDDED_INSIDE &amp;&amp; $gallery->app->feature["rewrite"]) {

to:
if ($gallery->app->feature["rewrite"]) {

 
robinbowes

Joined: 2002-09-20
Posts: 99
Posted: Mon, 2002-11-04 15:06
Quote:
Ah, I understand now.

The problem is that Gallery disables short URLs whenever it is embedded in anything. This is because I had a *Nuke bias when I wrote that code and Nuke prevents us from using short URLs. The folks who do the geeklog patch could remove this restriction in their next rev of the patch... Or you could modify the makeAlbumUrl() function in util.php:

change:
if (!$GALLERY_EMBEDDED_INSIDE &amp;&amp; $gallery->app->feature["rewrite"]) {

to:
if ($gallery->app->feature["rewrite"]) {

Bharat,

Thanks very much for staying with me on this! That sounds like it will fix the problem.

I'll make the changes tonight and let you know it it works.

Cheers,

R.

 
robinbowes

Joined: 2002-09-20
Posts: 99
Posted: Mon, 2002-11-04 22:20

He there,

I've just made the change you suggested and it works!

Gallery is now wrapped seamlessly inside Geeklog with Short URLs working perfectly!

Thanks again,

R.

 
ukulele

Joined: 2003-02-24
Posts: 3
Posted: Mon, 2003-02-24 09:17

Excellent job..! That worked for my problem that may or may not be related to this thread. See my thread at http://gallery.menalto.com/modules.php?op=modload&amp;name=phpBB_14&amp;file=index&amp;action=viewtopic&amp;topic=4165

I think this may be something that the gallery/geeklog integration kit may like to know about, if they already don't. I couldn't find any info about my specific problem on the various geeklog forums, or this forum for that matter. I was just desperate enough to do a general search for "geeklog" in the troubleshooting forum on this site and read through every single article. I'm just glad that the info in this thread helped.

I hope this problem and solution make their way into the various READMEs or FAQs, if it hasen't already and I just missed it..

Well done and many thanks to bharat and robinbowes for sticking with this issue.

-bob