aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathdesc <mathdesc@web>2012-08-18 14:27:32 -0400
committeradmin <admin@branchable.com>2012-08-18 14:27:32 -0400
commit1b7dc469b3217a1662235bc030cb4932e3b266d5 (patch)
tree27754cfc627780ee55bfdc1888a733f68c19ce4c
parent556c25d6ee43fe6d2303cb5830ab41ca65e2ccc3 (diff)
downloadikiwiki-1b7dc469b3217a1662235bc030cb4932e3b266d5.tar
ikiwiki-1b7dc469b3217a1662235bc030cb4932e3b266d5.tar.gz
Added a comment: For lighttpd with mod_magnet
-rw-r--r--doc/forum/missing_pages_redirected_to_search-SOLVED/comment_1_aa03c337b31d7acb95761eb51caab1ef._comment44
1 files changed, 44 insertions, 0 deletions
diff --git a/doc/forum/missing_pages_redirected_to_search-SOLVED/comment_1_aa03c337b31d7acb95761eb51caab1ef._comment b/doc/forum/missing_pages_redirected_to_search-SOLVED/comment_1_aa03c337b31d7acb95761eb51caab1ef._comment
new file mode 100644
index 000000000..eac5dc165
--- /dev/null
+++ b/doc/forum/missing_pages_redirected_to_search-SOLVED/comment_1_aa03c337b31d7acb95761eb51caab1ef._comment
@@ -0,0 +1,44 @@
+[[!comment format=mdwn
+ username="mathdesc"
+ subject="For lighttpd with mod_magnet"
+ date="2012-08-18T18:27:32Z"
+ content="""
+Same can be done for lighttpd via a lua script (said rewrite.lua) using *mod_magnet* than need to be installed and
+called in your conf like this :
+
+<pre>
+# error-handler for status 404
+$HTTP[\"url\"] =~ \"^/mysite/\" {
+magnet.attract-physical-path-to = ( server.document-root + \"/rewrite.lua\" )
+}
+</pre>
+
+Ref :
+[[mod_magnet docs|http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModMagnet]]
+
+
+
+<pre>
+
+ function removePrefix(str, prefix)
+ return str:sub(1,#prefix+1) == prefix..\"/\" and str:sub(#prefix+2)
+ end
+
+
+
+ attr = lighty.stat(lighty.env[\"physical.path\"])
+ local prefix = '/mysite'
+ if (not attr) then
+ -- we couldn't stat() the file
+ -- let's generate a xapian query with it
+ new_uri =removePrefix(lighty.env[\"uri.path\"], prefix)
+ print (\"page not found : \" .. new_uri .. \" asking xapian\")
+ lighty.env[\"uri.path\"] = \"/mysite/ikiwiki.cgi\"
+ lighty.env[\"uri.query\"] = \"P=\" .. new_uri
+ lighty.env[\"physical.rel-path\"] = lighty.env[\"uri.path\"]
+ lighty.env[\"physical.path\"] = lighty.env[\"physical.doc-root\"] .. lighty.env[\"physical.rel-path\"]
+ end
+</pre>
+
+Hope this is useful to you :)
+"""]]