0

I'm having trouble redirecting several domains & associated sub-domains to one other domain. Keep falling into a 301 infinite loop.

I have 3 domains, proxied to the same lighttpd process, say :

dom.co
dom.info
dom.net

dom.net is my domain of choice, what I want is to get every one, including www.*, going to my domain of choice. (dom.net is working)

My lighttpd.conf insteresting parts :

$HTTP["host"] =~ "(^|\.)dom\.net$" {
    /* working */
}

$HTTP["host"] =~ "(^|\.)dom\.co$" {
    url.redirect = ( "^/(.*)" => "dom.net/$1" )
}

the log :

IP dom.co - [16/Nov/2012:20:51:33 +0100] "GET /dom.net/ HTTP/1.0" 301 0 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11"
IP dom.co - [16/Nov/2012:20:51:33 +0100] "GET /dom.net/dom.net/dom.net/ HTTP/1.0" 301 0 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11"
et caetera.

I understand what's happening, not how to fix it. Please help !

r---------k
  • 947
  • 9
  • 18

1 Answers1

0

I went with this :

$HTTP["host"] =~ "^dom\.co" {
    /* ... */
}

# some redirections to dom.co
$HTTP["host"] =~ "dom.net|dom.info|www.dom.net|www.dom.info|www.dom.co" {
    url.redirect = ( "^/(.*)" => "http://dom.co/$1" )
}

I think the absence of http:// in front of the target url was what caused trouble, didn't tweak and try things around though, it's working now.

Idea comes from https://serverfault.com/questions/105920/how-do-i-redirect-multiple-domains-to-a-single-domain-in-lighttpd

Community
  • 1
  • 1
r---------k
  • 947
  • 9
  • 18