Skip to content

Multiple domains & redirects

Serve one app on several hostnames, and 301 www or brand domains to a canonical one.

Updated View as Markdown

domain: takes one or more hostnames — the first is canonical, the rest serve the same app (Caddy issues a cert per hostname). redirect_from: lists domains that 301 to the canonical one instead of serving.

homeport.yamlyaml
domain: example.com                 # or: [example.com, example.net]
redirect_from: [www.example.com]    # www → apex, path preserved

Which to use

  • redirect_from for www/canonical variants. Serving identical content on two hostnames splits your search ranking, so send one to the other.
  • Multiple domain: entries only when the app genuinely lives on several domains and each should serve.

Both lists are owned by the app — certs and redirects are created with it and removed with it, and no other app on the box can claim those hostnames.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close