尝试使用磁铁模块+ lua脚本
将磁铁模块添加到 lighttpd 模块
server.modules = (
...
"mod_magnet",
...
)
lighttpd 虚拟主机示例:
$HTTP["host"] =~ "^(example.com)$" {
server.document-root = "/var/www/example.com/document_root"
magnet.attract-physical-path-to = ( server.document-root + "/rewrite.lua" )
}
在document_root文件夹中创建rewrite.lua文件(根据上面的设置)
attr = lighty.stat(lighty.env["physical.path"])
if (not attr) then
lighty.env["uri.path"] = "/index.php"
lighty.env["physical.rel-path"] = lighty.env["uri.path"]
lighty.env["physical.path"] = lighty.env["physical.doc-root"] .. lighty.env["physical.rel-path"]
end
-- uncomment below for debug output to stdout
-- print ("final file is " .. lighty.env["physical.path"])
这篇文章的功劳归于 nette 论坛主题的“edke”用户
也可能值得尝试(或获得灵感):http ://www.guyrutenberg.com/2008/05/24/clean-urls-permalinks-for-wordpress-on-lighttpd/