如何在 lighttpd 中將多個網域重新導向到單一網域

如何在 lighttpd 中將多個網域重新導向到單一網域

如果我 在 lighttpd 中有以下網域:
domain1.comdomain1.co.ukdomain2.comdomain2.co.uk


我如何將所有這些重定向到“domain.com”?

即:
domain1.co.uk/some-path/ 重定向到domain.com/some-path/ 和
domain2.com/some-other-path/ 重定向到domain.com/some-other-path/

謝謝。

答案1

就像是:

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

應該可以工作 - 正如手冊頁所述;)

答案2

使用模組重定向正如 lighttpd 文件中所提到的。您可以採用許多範例。

相關內容