A host file is a DNS that is used to resolve a domain name to IP addresses that has nothing to do with ports.
If you are redirected from https://abc.com to https://xyz.com , then they will need different servers with different certificates, since the SSL certificate is bound to a domain name.
This means that if you use the hosts file to search for the abc.com ip address when you try https://xyz.com , then it will not work because the certificate will be for abc.com and will not match the https: // host xyz.com submitted by your browser.
Chris diver
source share