AlexT
Well-known member
I have seen a few suggestions to rewrite xF Urls using url.rewrite directives. Although it may work in most cases, it is not the recommended Lighttpd way.
One big advantage of Lighttpd is support of the Lua scripting language through the mod_magnet module. As Lighttpd doesn't provide Apache's is_file/is_dir check out of the box, this module comes into play. Lets assume xF is already installed under http://yoursite.com/community/ you now add the magnet part to it.
Installation
mod_magnet needs a Lighttpd which is compiled with the LUA-support option ( --with-lua). Lua 5.1 or higher are required by the module. In your Lighttpd config file, add the mod_magnet module along with your other server modules:
server.modules = ( ..., "mod_magnet", ... )
Configuration
In the Lighttpd config file for your xF installation:
The xenforo.lua file:
This Lua snippet routes all Url requests to non-existing locations to xF.
One big advantage of Lighttpd is support of the Lua scripting language through the mod_magnet module. As Lighttpd doesn't provide Apache's is_file/is_dir check out of the box, this module comes into play. Lets assume xF is already installed under http://yoursite.com/community/ you now add the magnet part to it.
Installation
mod_magnet needs a Lighttpd which is compiled with the LUA-support option ( --with-lua). Lua 5.1 or higher are required by the module. In your Lighttpd config file, add the mod_magnet module along with your other server modules:
server.modules = ( ..., "mod_magnet", ... )
Configuration
In the Lighttpd config file for your xF installation:
Code:
$HTTP["url"] =~ "^/community" {
# we only need index.php here.
index-file.names = ( "index.php" )
# for clean urls
magnet.attract-physical-path-to = ( "/etc/lighttpd/xenforo.lua" )
}
The xenforo.lua file:
Code:
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["request.orig-uri"] = lighty.env["request.uri"]
lighty.env["physical.path"] = lighty.env["physical.doc-root"] .. lighty.env["physical.rel-path"]
end
This Lua snippet routes all Url requests to non-existing locations to xF.