views:

276

answers:

1

I want to migrate some sites running on apache to Lighttpd.

Can anyone help me to convert this Rewrite rule into a equivalent rule for Lighttpd:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

I'm reading the Lighttpd rewrite explanation (http://redmine.lighttpd.net/wiki/1/Docs%3AModRewrite) but I didn't understand how convert this specific rule.

Thanks a lot

+1  A: 

The Apache rules you list use RewriteCond to take any request which doesn't go to a direcotyr (!-d) and which also doesn't go to a file (!-f) and redirects it to pass the URL data into index.php as parameter "url". It makes sure to preserve any other CGI arguments (QSA) and makes no further rules match if this rule matches (L).

So http://yourserver.org/something-silly would go to http://yourserver.org/index.ph?url=something-silly and http://yourserver.org/something-silly?q=search+terms would go to http://yourserver.org/index.ph?url=something-silly&q=search-terms

Lighttpd has url.rewrite-if-not-file which partially implements this, but it will rewrite URL if it's a directory. Therefore, you'll have to add rules to specifically NOT rewrite URLs that go to known valid directories.

Conspicuous Compiler