Redirect all undefined subdomains using Caddy

Viewed 8

Let's say my Caddyfile defines two sites: a.example.com and b.example.com.

What should I do so that any subdomain other than these two is redirected to a.example.com? For example, going to c.example.com or xyz.example.com should redirect to a.example.com

In other words, I want something like a 404 rule but for non-existent subdomains rather than non-existent files.

0 Answers
Related