I already asked in #lighttpd @ freenode if somebody can help me with
this. I'm running gallery2 with lighttpd and everything works great,
except the rewrite module with is designed for apache. here the
.htaccess
# BEGIN Url Rewrite section
# (Automatically generated. Do not edit this section)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php
RewriteCond %{REQUEST_FILENAME} !main\.php
RewriteRule . - [L]
RewriteCond %{THE_REQUEST} \ /admin/(\?.|\ .)
RewriteCond %{REQUEST_FILENAME} !main\.php
RewriteRule . /main.php?g2_view=core.SiteAdmin [QSA,L]
RewriteCond %{THE_REQUEST} \ /v/(\?.|\ .)
RewriteCond %{REQUEST_FILENAME} !main\.php
RewriteRule . /main.php?g2_view=core.ShowItem [QSA,L]
RewriteCond %{THE_REQUEST} \ /d/([0-9]+)-([0-9]+)/([^\/]+)(\?.|\ .)
RewriteCond %{REQUEST_FILENAME} !main\.php
RewriteRule .
/main.php?g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2
[QSA,L]
RewriteCond %{THE_REQUEST} \ /v/([^?]+)(\?.|\ .)
RewriteCond %{REQUEST_FILENAME} !main\.php
RewriteRule . /main.php?g2_view=core.ShowItem&g2_path=%1 [QSA,L]
</IfModule>
# END Url Rewrite section
already tried to convert them by myself but they didn't work, seems that
I'm too nooby for it ;/
would be great if somebody can help me out with it
on 19.12.2005 04:39
on 20.12.2005 17:51
butze wrote: > RewriteCond %{REQUEST_FILENAME} -f [OR] > RewriteCond %{REQUEST_FILENAME} -d [OR] > RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php > RewriteCond %{REQUEST_FILENAME} !main\.php > RewriteRule . - [L] I believe this passes the request through if (the file or directory exists or if the name is gallery_remote2.php) and the name is not main.php. I do not believe lighty's rewrite module is able to check whether files or directories exist, so I do not believe you can do this with lighty.
on 29.12.2005 05:52
butze wrote: > I already asked in #lighttpd @ freenode if somebody can help me with > this. I'm running gallery2 with lighttpd and everything works great, > except the rewrite module with is designed for apache. I know this isnt a complete solution, it works (very ish) but dont enable the rewrite module in gallery2 as you need more than this to handle GET vars. But it at least allows me to send "friendly" picture urls even if once you browse the site it all goes to pot! url.rewrite-once = ( "^/gallery/album/(.*)" => "/gallery/main.php?g2_view=core.ShowItem&g2_path=$1" ) e.g. http://cyberfish.org/gallery/album/snow05/IMG_0042.jpg (which actually isnt a jpeg :P)
on 29.12.2005 14:34
> already tried to convert them by myself but they didn't work, seems that > I'm too nooby for it ;/ > would be great if somebody can help me out with it These are the rules I wrote/converted for my site: url.rewrite = ( "^/gallery2/v/(\?.+|\ .)?$" => "/gallery2/main.php?g2_view=core.ShowItem", "^/gallery2/admin/(\?.+|\ .)?$" => "/gallery2/main.php?g2_view=core.SiteAdmin", "^/gallery2/d/([0-9]+)-([0-9]+)/([^\/]+)(\?|\ )?(.*)$" => "/gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=$1&g2_serialNumber=$2&$3", "^/gallery2/v/([^?]+)(\?|\ )?(.*)$" => "/gallery2/main.php?g2_view=core.ShowItem&g2_path=$1&$3" ) As far as I've seen all the navigation stuff in Gallery2 works as intended. The first rule is there because I couldn't get it to work as I wanted with the last rule. I don't quiet understand how lighttpd determines the $n variables, maybe someone could explain? I worked on the assumption that it pulls matching text using expressions in the parenthesis, but maybe it's just coincidence. I also left the '\ ' expression there from the original apache rules, not a clue what it does. If it does what I think, it's expecting a URL such as: http://sites.com/gallery2/v/albulm g2_page=2 When would that ever happen? Does anyone see any improvements that can be made to the rules?

