Is it possible to detect a non existant subdomain inside a "catch all" setup?

* user1.domain.ltd works
* user2.domain.ltd works
* nonexistant.domain.ltd does not work would like to redirect this to default.domain.ltd

are there any ways to do this?

\*\*I need a serverside way to detect if a subdomain is non existant to show a default one \*\*