Since most open source projects include mod_rewrite rules to work with Apache I need to be able to convert them to work with lighttpd or nginx. Which web server allows me to convert the rules exactly to the equivalent from Apache? If both can be converted exactly which one has better syntax and advanced options that would better mimic Apache's?
For example I'll use a .htaccess from Wordpress.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
nginX seems to be the way to go if you're trying to retain the rewrite rules.
This could be done like this:
But it seems like the power of nginX is to have less complex, smaller rules, so this might be a better way to replace that:
Just to make a complete answer for the next visitors, lighttpd does support rewrite rules although they don't support directly the equivalent of the -f and -d tags to verify the existence of a file and directory of the same name first.
There are currently three solutions:
Place your static files in a fixed directory, such as medias, and make an exception for this directory, such as:
Maybe look into "Cherokee" web server. Its a light, fast alternative to Apache and has some pretty nice features.
Regardless of which "light" webserver is faster (and they are all much faster then apache).. I will say this for Cherokee, the admin web interface is very easy to work with. Obviously, because it is web-based, the configuration is very different from apache. i would call It a pleasant different, not an irritating different.
but at the end of the day..., Only Apache is Apache. Apache's strength is its AAA-level flexibility.