lighttpd - use different document-root for diff url

To me this seem logical, but it doesn't seem to work.

$HTTP["host"] =~ "(^|\.)hd.domain\.com$" {
    server.document-root = "/domain_site/"

    $HTTP["url"] =~ "^/aa/" {
      server.document-root = "/domain_aa_site/"
    }

}

When I go to http://hd.domain.com/aa/ I get "404 - Not Found"

What am I doing wrong?


You're looking for lighttpd's mod_alias.

Something like this:

alias.url = (
  "/aa" => "/domain_aa_site/"
  "/somewhere/else" => "/other/docroot/"
)