3 subject="For lighttpd with mod_magnet"
4 date="2012-08-18T18:27:32Z"
6 Same can be done for lighttpd via a lua script (said rewrite.lua) using *mod_magnet* than need to be installed and
7 called in your conf like this :
10 # error-handler for status 404
11 $HTTP[\"url\"] =~ \"^/mysite/\" {
12 magnet.attract-physical-path-to = ( server.document-root + \"/rewrite.lua\" )
17 [[mod_magnet docs|http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModMagnet]]
23 function removePrefix(str, prefix)
24 return str:sub(1,#prefix+1) == prefix..\"/\" and str:sub(#prefix+2)
29 attr = lighty.stat(lighty.env[\"physical.path\"])
30 local prefix = '/mysite'
32 -- we couldn't stat() the file
33 -- let's generate a xapian query with it
34 new_uri =removePrefix(lighty.env[\"uri.path\"], prefix)
35 print (\"page not found : \" .. new_uri .. \" asking xapian\")
36 lighty.env[\"uri.path\"] = \"/mysite/ikiwiki.cgi\"
37 lighty.env[\"uri.query\"] = \"P=\" .. new_uri
38 lighty.env[\"physical.rel-path\"] = lighty.env[\"uri.path\"]
39 lighty.env[\"physical.path\"] = lighty.env[\"physical.doc-root\"] .. lighty.env[\"physical.rel-path\"]
43 Hope this is useful to you :)