Project

General

Profile

Possible to forward all domains like this?

Added by Geoff about 13 years ago

Hello. Allow me to explain what I'm trying to do:

I'd like to have lighttpd redirect all domains that resolve to nameservers I have set up to a location (which is dependent on the domain name..). In other words, I don't want to have to configure lighttpd for each domain. I want it to do the same for all domains.

Something like this:

$HTTP["host"] =~ "^(www\.)?anydomain\.tld$" { 
  url.redirect = (
    "^/(.*)$" => "http://www.someurl.com/details.php?domain=anydomain.tld",
  )
}

But how do I insert wildcards in there? Does that make sense?


Replies (1)

RE: Possible to forward all domains like this? - Added by Geoff about 13 years ago

Ok, I think I solved this:

$HTTP["host"] =~ "^(?:www\.)?([a-z0-9-]*\.[a-z]*)$" {
  url.redirect = ( "^/(.*)$" => "http://www.someurl.com/details.php?domain=%1", )
}

The text (domain) that is captured:

([a-z0-9-]*\.[a-z]*)

It is placed in the URL with:

%1

I'm a newbie to regex and open to suggestions/corrections :)

    (1-1/1)