I am trying to use lessn, a url shortener by Shaun Inman, on my lighttpd server and he uses a .htaccess file for the redirect. I am not very good with Mod_Rewrite isn the first place otherwise some simple googling would have sufficed to convert this for lighttpd. As it is, I do not know what the 2nd and 3rd lines of the Mod_Rewrite are doing, so I cannot convert. I'd appreciate anyone's advice on those so I can have it working as it should. Thank you!
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) index.php?token=$1 [QSA,L]
</IfModule>
Best Answer
These two lines instruct Apache's mod_rewrite to NOT apply the rewrite rule to files (f) and directories (d) that physically exist on the file system:
For a long time, lighttpd did not support this behavior out of the box and you had to use mod_magnet with a lua script, like this example:
http://drupal.org/node/43782
However, it looks like there is support now:
http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModRewrite#urlrewrite-repeat-if-not-file
So, just use that rewrite construct in your lighttpd.conf, something like:
Hope this helps and good luck!