I have a site which allows users to create their own microsite. At the moment they can access these microsites at clientname.example.com which triggers the following route:
"http://<clientSlug:[\w\-]+>.example.com" => 'client' // client is a module
I’d like users to be able to register their own domain name and be able to access their microsites through their-domain-name.com instead of the current subdomain. I’ll store the domain name in the database so I can look up which client it is from their domain name - but how should I handle the routing?
I’ve got dozens of clients so I can’t list each domain name individually. Any suggestions for how to architect the server are also gratefully received.