Alternative mod_rewrite for a few albums

First of all - thank you very much for the script and the wonderful support, trisweb!
Again, I have a question relating to how to seperate a function for two slightly different purposes (I promise, this will be the last question about this ;)

I'd like to have some albums mod_rewritten like this:
www.domain.com/albumname1
www.domain.com/albumname1/picture.jpg

And the rest all rewritten like:
www.domain.com/zenphotodirectory/albumname2
www.domain.com/zenphotodirectory/albumname2/otherpicture.jpg

Question 1.
Is it even possible to mod_rewrite it so that it appears to be in the root directory?
If not... then you can ignore the rest of this message ;)

I've tried playing around with it, putting a .htaccess in the root of my website:

`RewriteRule ^drawings/$ zenphoto/index.php?album=drawings

RewriteRule ^drawings/page/([0-9]+)/?$ zenphoto/index.php?album=drawings&page=$2

RewriteRule ^drawings/image/(thumb|[0-9]{1,4})/([^/\]+)$ zenphoto/zen/i.php?a=drawings&i=$3&s=$2

RewriteRule ^drawings/image/([^/\]+)$ zenphoto/albums/drawings/$2

RewriteRule ^drawings/([^/\]+)$ zenphoto/index.php?album=drawings&image=$2

RewriteRule ^photography/$ zenphoto/index.php?album=photography

RewriteRule ^photography/page/([0-9]+)/?$ zenphoto/index.php?album=photography&page=$2

RewriteRule ^photography/image/(thumb|[0-9]{1,4})/([^/\]+)$ zenphoto/zen/i.php?a=photography&i=$3&s=$2

RewriteRule ^photography/image/([^/\]+)$ zenphoto/albums/photography/$2

RewriteRule ^photography/([^/\]+)$ zenphoto/index.php?album=photography&image=$2

`
And modifying the getImageLinkURL() etc. like: if folder=drawings or photography, `return rewrite_path "../"`, else `"/"`
This only works for the "drawings" album, the other album gives Zenphoto error: Album does not exist. I really don't understand why it does this! (I tried adding [L, QSA] but the same problem exists.)

Is it because the two .htaccess files conflict with each other? Would it be tidier to do all the mod_rewriting in the zenphoto .htaccess file?
Or would it altogether be a lot easier two do two installs...?
I know modifications like these aren't really part of the normal zenphoto install, so I very much appreciate the help :)

Comments

  • trisweb Administrator
    Hmm... try...

    `

    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} -f [NC,OR]

    RewriteCond %{REQUEST_FILENAME} -d [NC]

    RewriteRule ^.*$ - [R,L]

    RewriteRule drawings/?(.*) zenphoto/drawings/$1 [R,L]

    RewriteRule photography/?(.*) zenphoto/$1 [R,L]`

    You've got the right idea I think, it just needs to pass it on to ZP.... that's what [R] is for (Redirect).

    Hope you don't mind, that actually does redirect the URL in the browser. There may be better ways to do it, I'm not sure...

    Wooo it's late, gnight.
Sign In or Register to comment.