• About

The Magic of mod rewrite and RewriteMap and Alternatives

July 18th, 2009

This is by far one of my favorite features of Apache. I use it for a variety of tasks, but mainly for managing url redirection.

As my sites change through the ages, the url structures change a little as well. I like to support inbound links, and to do so I use mod_rewrite to do so.

More specifically, I use mod_rewrite's RewriteMap function and its ability to read Berkeley database files. Its fast, easy, and reliable.

However, I have started to consider using NGINX and its built in rewrite capability as well as lighttpd and its mod_magnet (Lua) capacity. This has become more of an issue lately as I've switched from using the worker mpm to the prefork mpm, so every request to Apache makes a more significant impact to the server workload.

NGINX Rewrite I already use NGINX, so that is already take care of. However, NGINX takes a plain text file as the rewrite map and compiles it into a hash upon start. I don't feel that is optimal but I'm not aware of any internal options for NGINX. By internal I mean without using of a FastCGI process or anything. Actually the perl module might work, but I've never gotten that to work at all, yet. Maybe its time to try again! Honestly I wish NGINX had built-in Lua instead of Perl - we already have mod_perl for Apache.

Lighttpd's modmagnet This could be just what the doctor ordered, but for some strange reason I never embraced Lighttpd. I've tried it a bunch of times without any issues, but haven't yet used it in a production environment. Maybe its time to do so? If modmagnet does what I'd like it to, that is. UPDATE - I just tried this (installed lighttpd and lighttpd-mod-magnet on debian and manually built lua tinycdb) and it will work great. :-)

But wait! There are more options!

AOLServer4 and TCL For another unknown reason, I've always really liked AOLServer. It is an incredible software application and for whatever reason it isn't widely popular. Its had incredible features for many moons and might actually be the right choice for me. It has TCL (the command language) built-in, and there is a TCL library for accessing CDB (constant database) files available in Debian. Hmmmm - very interesting, this merits more research!

UPDATE - I tried this out and it will work as well. :-) This will probably be heavier and slower than Lighttpd and mod_magnet, but it has the upside of having all the dependencies available in the debian repositories.

qHttpd and Lua qHttpd also supports Lua hooks which is very very cool. I'm a big fan of qDecoder, so this might be the right choice too. Its not available in Debian yet though.


Yearly Indexes: 2010 2003 2005 2006 2007 2008 2009 2004 2011 2012 2013 2015 2019 2020