Gallery 1 and Lighttpd

Much like Apache, Lighttpd (lighty) has a rewrite module to rewrite URL requests; allowing ‘ugly’ page requests to look nice. Unfortunately, the rule sets I found on the net didn’t work too well with Menalto’s Gallery 1, so I ended up creating my own. The core change from the other rule sets I found is the ability to handle ?page=x on album views.

url.rewrite-final = (
 "^/gallery/([^.?/]+)/([0-9]+)$"
   => "/gallery/view_photo.php?set_albumName=$1&index=$2",
 "^/gallery/setup/"
   => "/gallery/setup/",
 "^/gallery/([^.?/]+)/$"
   => "/gallery/$1",
 "^/gallery/([^.?/]+)/([A-Za-z_0-9-]+)$"
   => "/gallery/view_photo.php?set_albumName=$1&id=$2",
 "^/gallery/([^.?/]+)/([A-Za-z_0-9-]+)\?([A-Za-z]+)=([0-9]+)$"
   => "/gallery/view_photo.php?set_albumName=$1&id=$2&$3=$4",
 "^/gallery/([^.?/]+)\?page=([0-9]+)$"
   => "/gallery/view_album.php?set_albumName=$1&page=$2",
 "^/gallery/([^.?/]+)$"
   => "/gallery/view_album.php?set_albumName=$1"  )