[V2]: Redirect all unknown domains to a specific page

1. Caddy version (caddy version):

v2.0.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=

2. How I run Caddy:

Uhm not sure what to put for this part

a. System environment:

Ubuntu 18.04

b. Command:


c. Service/unit/compose file:


d. My complete Caddyfile or JSON config:


3. The problem I’m having:

Not specifically a problem but a question to ask. Is it possible to redirect all unknown domain that the server doesn’t have configured in the caddyfile to a webpage i.e unknowndomain.html ?

4. Error messages and/or full log output:


5. What I already tried:


6. Links to relevant resources:


1 Like

Yes, but be aware that it will override automatic HTTP->HTTPS redirects.

See the discussion here:


hmm, I certainly wouldn’t want to break the automatic http to https redirect. Just had a read up on that page but would rather not change any config for now as there are live sites on there.

Thanks for clarifying that up. :slightly_smiling_face:

Redirects are easy to do manually, too:

:80 {
    redir https://{host}{uri}

Yes, I have tested that out and the manual redirects work fine. :slightly_smiling_face: I am using that on www sub domains.

I have noticed people trying to type www.domain.com (example) (was showing in the log file of sites that people where manually typing in - which wasn’t configured so I have now fixed that as a https redirect.

:grinning: :grinning: :grinning:

Ah yes, we have docs about that:

This topic was automatically closed after 30 days. New replies are no longer allowed.