If I have the following domains in lighttpd:
domain1.com
domain1.co.uk
domain2.com
domain2.co.uk

How do i redirect all these to to 'domain.com'?

ie:
domain1.co.uk/some-path/ redirects to domain.com/some-path/ and
domain2.com/some-other-path/ redirects to domain.com/some-other-path/

Thanks.

link|improve this question
feedback

2 Answers

up vote 2 down vote accepted

Something like:

$HTTP["host"] =~ "firsthost.example.com|secondhost.example.com|otherhost.example.net" {
  url.redirect = ( "^/(.*)" => "http://realdomain.example.org/$1" )
}

should work - as covered in the man page ;)

link|improve this answer
feedback

Use mod_redirect as mentioned in the lighttpd docs. There are a number of examples that you can adapt.

link|improve this answer
I have and couldn't see a clear way todo this. – sleepyjames Jan 25 '10 at 10:23
All you'd need to do is modify the first example slightly. – sybreon Jan 25 '10 at 13:37
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.