Hi,
I'm trying to write a rule that finds albums in the root directory but uses an album path. So, lets say I have an album called 'test-album' which is blank, and another album called 'image-album-1' with images in it. I want to be able to type zenphoto/test-album/image-album-1/ and go to zenphoto/image-album-1
shouldn't the re-write look like this:
RewriteRule ^(test-album)/?(.*?)/?$ index.php?album=$2 [QSA]
Thanks!
Your best bet for this is the apache forums, for instance http://www.addedbytes.com/cheat-sheets/mod_rewrite-cheat-sheet/
Well, of course it looks at the get param. Just look at the code. That is what normally happens with a site setup for mod_rewrite. Of coures, what you wish to do is not ordinary for Zenphoto so it's mod_rewrite rules do not do it.
You will have to study how to make rewrite rules and make your own. This is not a forum on mod_rewrite rules. I did give you a link to one, there are others.
I have checked that link out, and see nothing wrong with the way I'm doing the mod_rewrite, which was why I was asking about the feasibility of doing this at all. If I print out the $_SERVER vars from the album page I see:
REDIRECT_URL /zenphoto/index.php
REDIRECT_QUERY_STRING album=sub-album-2
Which is exactly what I want. Why then is it not going to the album? The only thing I can think of is that it's not really looking at the album param, and instead looking at the url.
Can anyone confirm this?
Ah, the rewrite_get_album_image() is pretty much what I thought was going on, but I didn't know where to find it.
I have gotten it to work now by adding another param into my mod_rewrite and ignoring the function that checks the url in rewrite_get_album_image().
As far as why I'm doing this, it's because the site I'm working on needs duplicate projects in multiple categories (which I'm doing with tags) but also has a highlighted navigation which needs to reflect where the user is. So if a project exists in the root and that's where it's getting re-directed then that doesn't work since it'll lose its context. So now, the mod_rewrite works like this:
RewriteRule ^(cat1|cat2|etc.)/+?([A-Za-z0-9_-]+){1,}/?$ index.php?album=projects/$2&category=$1&project=1 [L,QSA]
RewriteRule ^(cat1|cat2|etc.)/?$ index.php?album=categories/$1&category=$1 [L,QSA]
RewriteRule ^(.*)/?$ index.php?album=$1 [L,QSA]
So I can just put all my categories into an album called categories, and all the projects into a projects album, and do the rest with tags.