webzod
account

Redirect www and apex to one host on Caddy

headers.redirect.www_split · effort: minutes

Why it matters

Both names serve the site, so search engines see duplicate pages and logins, cookies and HSTS are split between two hosts. Pick one canonical host and permanently redirect the other to it.

The fix

  1. Give the non-canonical name its own site block that only redirects, as below, and reload Caddy. Caddy gets the certificate for it automatically.
Caddyfile
www.example.com {
	redir https://example.com{uri} permanent
}

example.com {
	# ... your existing directives
}

The examples use example.com. Replace it with your own domain.

Read the documentation (opens in a new tab)

Scan your domain to see whether this applies to you.