July 22nd, 2008 - Multiroot gallery2 across servers

I recently tried and succeeded at getting the multiroot feature of gallery2 work across servers.  The multiroot plugin that gallery2 comes with just creates a template index.php and .htaccess file.  The main problem with it is that it requires a “require_once” call that includes a file from the gallery2 install.  This wouldn’t work since the multiroot I want is on a different domain and a different server.

So I first attempted to get the multiroot to work on a subdomain of the original domain.  This gave me a bit of grief as the original gallery2 install is in a subdirectory.  And so I had to set up a .htaccess rule that would redirect requests that weren’t caught be the normal multiroot template .htaccess and send them through a “fetch” script that would curl the files.

That took a bit of work because the template .htaccess was definitely a template.  I pretty much rewrote it in the end.

But once it was done, I then set up my other domain (on the other server) and created a rewrite rule (inside a .htaccess file) that caused all trafic to go through its own “fetch” file.  This would then fetch from the actual multiroot, which would then fetch from the real install.

In the end, I made it so that if you go to the other domain, the page shows no indication of what server it is pulling from.  It is a little slow because of all the extra network requests, but as it is only going to be used for family, I’m pretty happy with what I did.

Leave a Reply