The URL Rewrite module does not directly support lighttpd, but can be made to work by manually putting rewrite rules in place.
touch /srv/www/localhost/gallery2/.htaccess chmod 666 /srv/www/localhost/gallery2/.htaccess
server.modules = ( "mod_rewrite", "mod_access", "mod_fastcgi", "mod_ssi", "mod_usertrack", "mod_accesslog" )
Your Lighty will load that module. Now you have to add the url.rewrite rules to your configuration file. Lighty will parse the requested url and go transparently to the destination defined after the '=>'. Add these lines to your /etc/lighttpd/lighttpd.conf file:
url.rewrite = ( "^/(.*)/Rewrite.txt$" => "/$1/Works.txt", "^/gallery2/v/(\?.+|\ .)?$" => "/gallery2/main.php?g2_view=core.ShowItem", "^/gallery2/admin[/?]*(.*)$" => "/gallery2/main.php?g2_view=core.SiteAdmin&$1", "^/gallery2/d/([0-9]+)-([0-9]+)/([^\/]+)(\?|\ )?(.*)$" => "/gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=$1&g2_serialNumber=$2&$3", "^/gallery2/v/([^?]+)/slideshow.html" => "/gallery2/main.php?g2_view=slideshow.Slideshow&g2_path=$1", "^/gallery2/v/([^?]+)(\?|\ )?(.*)$" => "/gallery2/main.php?g2_view=core.ShowItem&g2_path=$1&$3", "^/gallery2/c/add/([0-9]+).html" => "/gallery2/main.php?g2_view=comment.AddComment&g2_itemId=$1", "^/gallery2/c/view/([0-9]+).html" => "/gallery2/main.php?g2_view=comment.ShowAllComments&g2_itemId=$1", "^/gallery2/f/(.+)" => "/gallery2/main.php?g2_controller=permalinks.Redirect&g2_filename=$1", "^/gallery2/key/([^?]+)(\?|\ )?(.*)$" => "/gallery2/main.php?g2_view=keyalbum.KeywordAlbum&g2_keyword=$1&$3", "^/gallery2/contact" => "/gallery2/main.php?g2_view=contactowner.Contact", "^/gallery2/srss/([0-9]+)$" => "/gallery2/main.php?g2_view=rss.SimpleRender&g2_itemId=$1", "^/gallery2/v/([^?]+)/slideshowapplet.html" => "/gallery2/main.php?g2_view=slideshowapplet.SlideshowApplet&g2_path=$1", "^/gallery2/updates(\?.+|\ .)?$" => "/gallery2/main.php?g2_view=dynamicalbum.UpdatesAlbum", "^/gallery2/popular(\?.+|\ .)?$" => "/gallery2/main.php?g2_view=dynamicalbum.PopularAlbum", "^/gallery2/random(\?.+|\ .)?$" => "/gallery2/main.php?g2_view=dynamicalbum.RandomAlbum" )
(Note: while the dynamic album rewrite rules--the last three rules above--work for the first page, it seems for some reason using the Next, Last, or page links always show page 1. If you know how to correct this, please login and edit this page.)
If needed, change gallery2 to your gallery2 path. The above rules are for the default patterns in the URL Rewrite module (the /v/, /d/, etc parts above). Any changes to these in URL Rewrite Site Admin will require matching changes to these rules.
Stop Lighty, and start it again from a commandline to see if you have made any typo. If it gives no error, it should be working.