Re-organizing Albums

Tobias Member
edited May 2019 in General support

After a few years of usage we now came to the conclusion that our Zenphoto site would benefit from a re-organization of the existing 350+ albums. Mainly because there are so many of them (~50) on the top-level of the site, but also because there is no predictable and/or coherent naming pattern.

While such a re-organization is manageable in Zenphoto we would be facing the immense task of adjusting all the external links pointing to our Zenphoto images and pages. So I was wondering if there was a smarter way to tackle this challenge than to simply rename/move the Zenphoto folders.
I know this is NOT a Zenphoto problem in the first place, but I thought you guys might have an idea or know of some approach someone has taken to change the structure of the albums while keeping legacy links working.

Some ideas I was playing around with already:
How would Zenphoto react to sym-links replacing the old folders that are pointing to the moved/renamed folders? Assuming they are treated like regular albums: Can those sym-link albums be set unpublished so they don't show up in the gallery/their parent albums? Would this double the number of images in the database?

Another idea I had was to move the folders and create .htaccess rewrite rules for the old names. Would this be enough for the legacy links created by Zenphoto to still work or are there references hidden in the database that would require an actual folder to exist while answering such a request?

Any input is appreciated! Thank you!


  • acrylian Administrator, Developer
    edited May 2019

    Since Zenphoto's gallery is file system based so any change in structure should reflect this. I think symlinks for all this could get quite complicated to manage and opens issue possibilities.

    You baseically want to redirect outdated links not existing anymore to the actual current one. Which is naturally a good idea for SEO. htaccess would be the server side way to archive such redirections of outdated links to current one with http status code "301 moved permanently". htaccess happens before Zenphoto is involved itself. You basically catch outdated links right at the beginning.

    An alternative could be a new filter hook in 1.5.2 you might find interesting. That will allow to redirect pages after a bit ZP setup but before the actual theme page contextes are setup. You would have to write a plugin that features a catalogue of old current urls and their then new destinations. Then you could check the current request and redirect to the actual destinations on matches. This is already in the 1.5.2b support build. The filter hook is named "redirection_handler". It just passes the current url request you can then filter and change to the new location (it does not allow external links).

    htaccess could be better performance wise if there is a lot to compare I assume since above there is still some setup involved even if the theme page setup is not yet done.

  • Tobias Member

    Oh, that new filter hook sounds promising! Just in time.
    I might prefer this over .htaccess because that plugin would serve a sole and dedicated purpose while .htaccess cannot be modularized (as of now), I think. These redirects might stay there for a looong time. :wink:

  • acrylian Administrator, Developer

    Keep an eye on the support build. I originally wanted to spare this for later but since you are a good candidate for testing ;-) I am seeing to add a simple plugin which can load a json or csv file (so you can maintain your list of redirections via Excel or similar) of redirection pairs.

  • ctdlg Member

    You can also

    • export your database with phpmyadmin
    • edit your sql file
    • search and replace all concerned links
    • save as a new database file name
    • phpmyadmin : delete your database, recreate it
    • import your modified sql file
    • enjoy

    I did use this on my website !
    Fast ! And you cannot miss a link.

  • acrylian Administrator, Developer
    edited May 2019

    @ctdlg I think you misunderstood the problem. The issue here is really not how to re-organize. ZP has tools to move and rename albums.
    The issue here not to have those then non existing old links to break. This will lead to errors if anyone linked from somehwere or even Google. Google will re-index that new so you even may loose ranking. So it is a good idea to redirect the old urls to the new actual existing ones.

  • ctdlg Member

    I understand your comments.

    I did a comment about links in albums, images descriptions or pages, articles - not about automatic links when clicking on a thumb.

    If you rename a folder, your own link using this folder name have to be modified too, and my method is fast.
    This was a bit out of topic, but I thought it was useful.

  • acrylian Administrator, Developer

    Ah, sorry, I indeed misread that somehow! As long as you redirect old URL to new URLs this would also be covered. But yes the best is of course to update static links.

Sign In or Register to comment.