发现有时候做非主流还真痛苦。。 现在用的这个vps是centos5 + 免费的kloxo主机管理系统。kloxo用的lighttpd,所以wp-super-cache的那套apache的rewrite规则就完蛋了~ 于是搜lighttpd的重写规则,找到了一个老外的帖子, 需要启用mod_magnet(这个模块可以使用lua脚本进行更强大的url重写) 于是我把/etc/lighttpd/lighttpd.conf里mode_magnet的注释删掉
server.modules  = (
         "mod_rewrite",
         "mod_redirect",
         "mod_alias",
         "mod_access",
         "mod_magnet",
... ...
然后
/etc/init.d/lighttpd restart
我得到了下面的错误
mod_magnet plugin init failed
于是我继续google,发现需要重新编译下lighttpd,郁闷了。。 安装lua,发现有现成的包
wget http://packages.sw.be/lua/lua-devel-5.1.4-1.el5.rf.i386.rpm
rpm -i lua-devel-5.1.4-1.el5.rf.i386.rpm 
wget http://packages.sw.be/lua/lua-5.1.4-1.el5.rf.i386.rpm
rpm -i lua-5.1.4-1.el5.rf.i386.rpm
yum安装编译工具和其他依赖
yum install gcc glib2-devel autoconf automake libtool  openssl-devel pcre-devel bzip2-devel gzip-devel zlib-devel
编译安装lighttpd
wget http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.25.tar.gz
tar -zxvf lighttpd-1.4.25.tar.gz
cd lighttpd-1.4.25
./configure --with-pcre --with-lua --with-zlib --with-openssl --sbindir=/usr/sbin --sysconfdir=/etc/lighttpd
make
make install
运行完毕,就可以把原有的lighttpd覆盖掉了,再次启用mod_magnet,成功~ 然后就是配置这个重写的lua脚本,老外给的那个脚本是有问题的,所以自己又修改了下,大体的配置如下
$HTTP["host"] =~ "^(www.bluehua.org|bluehua.org)" {
#重写开始
server.error-handler-404   =  "/index.php"
magnet.attract-physical-path-to = ("/document-root/rewrite.lua")
#结束,就这就两句管用了
.......
}
最后我改过的脚本下载:rewrite.lua 总算是好使了。。