• Hello everyone.
    I had run a wpmu site 2.9 on a vps with lighttpd with mod_magnet without any problems, then two days ago I managed to upgrade to the newest version 3.0.1 so I make a new installation for the test then I met problem.

    After installation I enabled multisite feature, the main site (mysite.com) works smoothly under super cache, then I created a test sub-site (test.mysite.com), it seems the main page has no error, but when I visiting the category, pages,comments all return to a blank page with 404 error.

    I think that is a rewrite problem, but I’v no idea to solve it, anyone can help?

    centos 5.5
    lighttpd: 1.4.26
    and here is the content in my rewrite.lua

    -- wpsupercache
    function serve_html(cached_page)
      -- don't double stat here (see code below)
      lighty.env["physical.path"] = cached_page
      --print("Serving cached page: " .. cached_page) -- debug only
    end
    
    function serve_gzip(cached_page)
      if (lighty.stat(cached_page .. ".gz")) then
        lighty.header["Content-Encoding"] = "gzip"
        lighty.header["Content-Type"] = "text/html" -- should be text/html, look at wpsupercache-readme!!
        lighty.env["physical.path"] = cached_page .. ".gz"
        --print("Serving gzipped page: " .. cached_page .. ".gz") -- debug only
        return true
      else
        return false
      end
    end
    
    -- add trailing slash on admin
    if (lighty.env["request.uri"] == "/wp-admin") then
        lighty.header["Location"] = "/wp-admin/"
        return 301
    end
    
    -- wpsupercache
    -- index access stays uncought, as it is an existing path (aka index.php)
    if (not lighty.stat(lighty.env["physical.path"]) or lighty.env["physical.rel-path"] == "/" ) then
      query_condition = not (lighty.env["uri.query"] and string.find(lighty.env["uri.query"], ".*s=.*"))
      user_cookie = lighty.request["Cookie"] or "no_cookie_here"
      cookie_condition = not (string.find(user_cookie, ".*comment_author.*") or string.find(user_cookie, ".*wordpress.*") or string.find(user_cookie, ".*wp-postpass_.*"))
      -- for some reason this condition was forgotten...
      method_condition = not (lighty.env["request.method"] == "POST")
      if (query_condition and cookie_condition and method_condition) then
        accept_encoding = lighty.request["Accept-Encoding"] or "no_acceptance"
        cached_page = lighty.env["physical.doc-root"] .. "/wp-content/cache/supercache/" .. lighty.request["Host"] .. lighty.env["request.uri"] .. "/index.html"
        cached_page = string.gsub(cached_page, "//", "/")
        if (lighty.stat(cached_page)) then
          if (string.find(accept_encoding, "gzip")) then
            if not serve_gzip(cached_page) then serve_html(cached_page) end
          else
            serve_html(cached_page)
          end
        end
      end
    end
    
    -- default wpmu-handling
    if (not lighty.stat(lighty.env["physical.path"])) then
      if (lighty.env["request.uri"] == "/sitemap.xml") then
        lighty.env["physical.rel-path"] = "wp-includes/ms-files.php"
        lighty.env["uri.query"] = "file=sitemap.xml"
      elseif (lighty.env["request.uri"] == "/sitemap.xml.gz") then
        lighty.env["physical.rel-path"] = "wp-includes/ms-files.php"
        lighty.env["uri.query"] = "file=sitemap.xml.gz"
      elseif (lighty.env["request.uri"] == "/favicon.ico") then
        lighty.env["physical.rel-path"] = "wp-includes/ms-files.php"
        lighty.env["uri.query"] = "file=favicon.ico"
      elseif (string.match(lighty.env["uri.path"], "^(/?[^/]*/)files/$")) then
        lighty.env["physical.rel-path"] = "index.php"
      else
        n, a = string.match(lighty.env["uri.path"], "^(/?[^/]*/)files/(.+)")
        if a then
          lighty.env["physical.rel-path"] = "wp-includes/ms-files.php"
          lighty.env["uri.query"] = "file=" .. a
        else
          n, a = string.match(lighty.env["uri.path"], "^(/?[^/]*/)(wp-.*)")
          if a then
            lighty.env["physical.rel-path"] = a;
          else
            n, a = string.match(lighty.env["uri.path"], "^(/?[^/]*/)(.*\.php)$")
            if a then
              lighty.env["physical.rel-path"] = a
            else
              lighty.env["physical.rel-path"] = "index.php"
            end
          end
        end
      end
      lighty.env["physical.path"] = lighty.env["physical.doc-root"] .. lighty.env["physical.rel-path"]
    end
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘lighttpd with mod_magnet sub-site 404 page’ is closed to new replies.