I'm trying to configure lighttpd so that:
- www.domain1.org/admin uses config1
- any other URL on www.domain1.org uses config2
- any url on www.domain2.org uses config2
So basically, domain1 and domain2 should use the same configuration except for when domain1 is accessed via an URL that starts with /admin
I tried so far a number of variations, including this one:
$HTTP["host"] =~ "domain1.org" {
$HTTP["url"] =~ "^/admin" {
// config1
alias.url = ("/media/admin" => "/usr/share...",
"/static" => "/var/www/...")
url.rewrite-once = (
"^(/media/admin.*)$" => "$1",
"^(/static.*)$" => "$1",
"^/favicon\.ico$" => "/media/favicon.ico",
"^(/.*)$" => "/application.fcgi$1",
)
server.document-root="/var/www/application"
fastcgi.debug = 1
fastcgi.server = (
"/application.fcgi" => (
"main" => (
"socket" => "/var/www/application/application.sock",
"check-local" => "disable",
)
),
)
} else $HTTP["url"] !~ "^/admin" {
// config2
}
$HTTP["host"] !~ "domain1.org" {
// config2
}
But no matter what, accessing domain1.org/admin yields a 404.
Is there anything that I am missing?
Best Answer
See http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModRewrite:
Also the rewrites must always use the absolute path, so you should prefix your matches with /admin, and targets and the fastcgi.server match too.