When you click on a gallery it tries to go to /gallery/*dire

jodeyeman

Joined: 2002-10-04
Posts: 10
Posted: Tue, 2002-11-26 16:23

When you click on a gallery it tries to go to /gallery/*directory*
but the location does not really exist.
How does gallery take that url and make it point to the right places?
Where does it point to what file or dat tells it to do so?

Again thanks for your time

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3473
Posted: Tue, 2002-11-26 17:22

Hi... this is what mod_rewrite does.
It converts something like
http://www.mysite.com/gallery/album/photoname
to
http://www.mysite.com/gallery/view_photo.php?set_albumName=album&id=photoname
which is what you're really looking at. You can see these rules in your .htaccess file. So the gallery/album doesn't exist in real life... you're really just looking at gallery/view_album.php or gallery/view_photo.php.

Is this not working correctly for you??

 
pbyjp
pbyjp's picture

Joined: 2002-11-12
Posts: 260
Posted: Tue, 2002-11-26 17:32

Hi,
I will try to answer with what I have learned from my own problems...
The fact that it goes to the /gallery/name of album is pretty neat I admit. and it s all done by the .htaccess file that sits in your gallery folder.
If the server your gallery is hosted on has mod_rewrite enabled, then when you do your configuration, gallery will configure the .htaccess file accordingly so that it works.
To know if you have mod_rewrite working, check with http://www.path.to/your/gallery/setup/phpinfo.php or with your ISP.
If it s enabled, then you saved yourself hours of cursing, if it is disabled, you ll have to nicely ask your ISP to enable it for you... have a look in the FAQ on this site to know how to do it if you host your website yourself on your computer.

Now a typical .htaccess file should look something like:
> Options +FollowSymlinks

This is just nice to have symlinks working properly

Okay... now to mod_rewrite. You might need to fidget with the "/gallery" prefix, but I think this will be correct for your setup. You then need to go into "config.php" and make sure that $gallery->app->feature["rewrite"] is set to 1. (without the > at the begining of the line)

> <IfModule mod_rewrite.c>
> RewriteEngine On
> RewriteBase /gallery/
> RewriteRule ^([^.?/]+)/([0-9]+)$ /gallery/view_photo.php?set_albumName=$1&amp;index=$2 [QSA]
> RewriteRule ^([^.?/]+)/([A-Za-z_0-9-]+)$ /gallery/view_photo.php?set_albumName=$1&amp;id=$2 [QSA]
> RewriteRule ^([^.?/]+)/$ /$1 [R]
> RewriteRule ^([^.?/]+)$ /gallery/view_album.php?set_albumName=$1 [QSA]
> </IfModule>

I know all of this cos Beckett helped me a lot a while ago (thanx again btw), here is what he was also explaining to me:
The first Rewrite rule lets you enter something like:
.../gallery/my_album/53
And be transported to that exact photo number (53)
The second RewriteRule lets you enter:
.../gallery/my_album/name_of_photo
And be transported to that exact photo (called "name_of_photo")
The next rule strips a trailing slash and calls one of the other rules
The final rule lets you enter:
.../gallery/my_album
And be transported to that album

Now you can search the forums for additional infos and check the FAQ too.
Please readers, correct me if I am wrong.
Otherwise Jodeyeman, good luck!
:smile:

p

EDITED:
oups, didn t see Beckett answered while I was making up the whole answer...

 
dtdgoomba

Joined: 2002-11-04
Posts: 185
Posted: Tue, 2002-11-26 20:21

Awesome, this was my question in the suggestion forum that beckett mentioned gallery already had. Should make search engines so much easier to index now. Thanks, it's up and working!

The only problem I had with both my blog and gallery is that I used webdav and now htaccess keeps me from using it. my tech guy is on vacation so I can't ask him about it until later on, but in the meanwhile, here they are, in all their uh glory

<!-- BBCode Start --><A HREF="http://anthony.torres.name/gallery" TARGET="_blank">http://anthony.torres.name/gallery</A><!-- BBCode End -->

Actually, I need my admin guy to activate htaccess for this one, but it'll be adjusted shortly . I'll thank you anyway :wink:
<!-- BBCode Start --><A HREF="http://www.goombalooza.com" TARGET="_blank">http://www.goombalooza.com/gallery</A><!-- BBCode End -->