Project

General

Profile

1 - Install Joomla

2 - Go Joomla admin -> Global Configuration -> Site. Enable Search Engine Friendly URLs and Use Apache mod_rewrite

3 - In lhttpd add this site description, where change '''


$HTTP["host"]

and


server.document-root

to you's settings

Example


$HTTP["host"] =~ "(^|\.)site\.com$" {
server.document-root = "/usr/local/www/data/site.com" 
   url.rewrite-once = (
          "^images\*\.(jpg|jpeg|gif|png)" => "$0",
          "^/administrator.\*$" => "$0",
          "^/mambots.\*$" => "$0",
          "(/|\.htm|\.php|\.html|/[^.]\*)$" => "/index.php" 
     )
}

Instead of this you can do the rewrites it using lua. Create a new file and add:


-- little helper function
function file_exists(path)
  local attr = lighty.stat(path)
  if (attr) then
      return true
  else
      return false
  end
end
function removePrefix(str, prefix)
  return str:sub(1,#prefix+1) == prefix.."/" and str:sub(#prefix+2)
end

-- prefix without the trailing slash
local prefix = ''

-- the magic ;)
if (not file_exists(lighty.env["physical.path"])) then
    -- file still missing. pass it to the fastcgi backend
    request_uri = removePrefix(lighty.env["uri.path"], prefix)
    if request_uri then
      lighty.env["uri.path"]          = prefix .. "/index.php" 
      local uriquery = lighty.env["uri.query"] or "" 
      lighty.env["uri.query"] = uriquery .. (uriquery ~= "" and "&" or "") .. "q=" .. request_uri
      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
end
-- fallthrough will put it back into the lighty request loop
-- that means we get the 304 handling for free. ;)

Then on your lighttpd.conf add something like this:


$HTTP["url"] !~ "^/(xcache-admin|awstatsclasses|awstatsicons|awstatscss|awstats|cacti|webmail|phpmyadmin)(/|$)" {
index-file.names = ( "index.php" )
magnet.attract-physical-path-to = ( "/usr/local/etc/lighttpd/lua/domain.com/www.lua" )
}

Updated by Jormangeud almost 5 years ago ยท 8 revisions