url rewrite help

Hi, I need some help to shorten my images URLs.
I don't know how to write the rule for the .htaccess file.

What i have now is: http://www.mysite.com/gallery/album-name/photo-name.jpg.html

I want the images URLs looks like: http://www.mysite.com/gallery/photo-name

the rewrite rule has to remove the album-name directory and the .jpg.html extension

I'll appreciate any help

Thanks!

Comments

  • acrylian Administrator, Developer
    That will be quite complicated as Zenphoto always will generate those other urls.

    `http://www.mysite.com/gallery/photo-name` is the link to an album `photo-name` which is a subalbum of the album `gallery`. You can remove the "html" as that is just an option (modrewrite suffix) but the ".jpg" is rather required as it otherwise get confusions with other items.

    Also Zenphoto does not create its rewritten urls via htaccess primarily but internally now.
  • What you want is not practical before the 1.4.6 release. Even there it is not something for the neophyte to attempt.

    First, rewrite rules are only a small portion of the issue as acrylian has said. They only process the URL when the browser submits it. You also need to modify the URLs that Zenphoto creates in the first place.

    Some other considerations:

    Do you have more than one album? If so there may be duplicate image names. Then which is the chosen one? Even if there are no duplicates finding which album to use will be costly in terms of performance (specially if you wish to omit the image suffix.)

    If you simplify things, only one album, all images must have the same suffix, then you could accomplish this.

    You will have to filter the link generation for images to remove the album name and the suffix. Then you will have to filter the links so that you intercept "album" requests and turn them into the appropriate image request.

    There is a plugin named `tinyURL` in the 1.4.6 release that performs all these steps, but for replacing the link with a special one, not for making links like you desire. Making it work for you is an exercise left to the student.
  • ok. thanks for the help guys
Sign In or Register to comment.