Lets encrypt issue with multiple domains

I have a TLD plus an number of other TLD’s which point to the main TLD and set up as aliases. Creating the cert works fine and also re-directs to the main domain if you just enter www.TLD2.com or TLD2.com However if you use https://www.TLD2.com or https://TLD2.com it doesn’t work as it defaults to the site set up as the servers default main server.

If on the other hand I set up the additional domains as sub servers and then a website re-direct it works fine. The problem with this is that now the cert won’t renew as it throws errors as it says it receives an invalid response from the sub servers acme-challange.

Other than creating all secondary domains either as separate virtual servers or sub domains and generating separate certificate for each one then adding a meta refresh in the index file for each site I can’t see another way around this and would be far from ideal.

P.S. I’m using Certbot.

All help and advice would be much appreciated. Thanks in advance.

I have a similar problem and am thinking about writing a script to add symlinks to the right places for each domain, but would prefer a better solution if anyone comes up with one here - TIA

P.S. I’m using the virtualmin Let’s Encrypt interface, maybe I should also try certbot?

A word of warning. If you start using Cerbot you can no longer go back to using virtualmin Let’s Encrypt as it won’t allow it.

P.S. I posted this question on the Let’s Encrypt support forum and will report back, but of course if anyone here can help it would be greatly appreciated.

So has anyone found a solution to this problem yet? I have TLD1 that I just manually put some ServerAlias lines into its VirtualHost section for TLD2 in the main httpd.conf file but of course since there’s no certificate for TLD2. Don’t know who to handle two domains pointing to the same files.

Okay so I just figured out how to solve the problem. I had manually added ServerAlias lines to httpd.conf. I removed those and then added TLD2 correctly as an alias through the Virtualmin web interface. I posted the question on ServerFault as well with a few more details.