mod_rewrite problem with lighthttp

Tag: mod-rewrite , url-rewriting , lighttpd Author: pengke1999 Date: 2009-09-02

I am using mod_rewrite with lighttpd, and I am having an issue...

Here is my rule:

url.rewrite-once = (".*\.(js|ico|gif|jpg|png|css)$" => "$0", "" => "/index.php")

The apache rule works on apache, and looks like this:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d   
RewriteRule !\.(js|ico|gif|jpg|png|css)$ /index.php

It works perfectly, except, when I want to use phpmyadmin, http://www.site.com/phpmyadmin is of course being redirected to where I am telling it to... however, I would really like it to work with real directories and files.

How can I change the rewrite rule in lighttpd to respect things such as /phpmyadmin?

Edit:

Looking over everything and doing some research, I am missing the lighttpd equivilent of these lines:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

How can I add these to the lighttpd rewrite config?

Best Answer

After a lot of messing around, reading, and many other painstaking things, I came up with this, and I hope it helps everyone else with the same problem I had...

url.rewrite-once = (
"/(.*)\.(.*)" => "$0",
"/(phpmyadmin|css|img|js)/" => "$0",
"^/([^.]+)$" => "/index.php/$1"
)

So: http://www.site.com/class/method/test/1/test2/2 (WILL WORK AS EXPECTED) http://www.site.com/phpmyadmin/ (WILL WORK AS EXPECTED - note trailing slash)