I faced the task of connecting 2 domains to 1 site. I read the topics on the forum, found out that there was a problem connecting the second domain with https.
This problem was posed as a task for the developers of the panel. But I didn’t know if this problem had been solved.
Indeed, if I create an alias for the main domain, then I get a second domain with an HTTPS certificate.
The problem turned out to be that when you enter the main domain with www. redirection from the alias to the main domain was included.
I disabled forwarding for the domain. Everything works, but then there is no redirection with www. on without www.
Therefore, be sure to create your domain.com alias for correct operation and www.domain.com
Make the redirect not in the domain settings, but in the config file - /home/domain/conf/web/domain/nginx.conf_redirect
To its code, you need to add a redirect for the main domain and alias.
if ($host = www.maindomain.com) {
return 301 https://maindomain.com$request_uri;
}
if ($host = www.domain.com) {
return 301 https://domain.com$request_uri;
}
I think this will help to get the opportunity to correctly connect 2 or more domains to the site without looking for a solution to this problem.