Question

May be this is a weird question, but I am curious to know if single hosts file entry can contain multiple domains on same line?

I know that following is okay for host entry:

127.0.0.1 somedomain.com

But, I want to know if following would work:

127.0.0.1 somedomain.com, alternate-domain.com, subdomain.domain.com

or

127.0.0.1 somedomain.com, *.domain.com

(Note: I am doing hosts file entries on windows)

May be this has been asked before, but I googled before writing my question, and I didn't quite find a good answer. Thanks for taking time to read and answering, it will be pretty helpful.

Was it helpful?

Solution

I found the solution.

On IIS, I had to add https in bindings associating it to use IIS Development Certificate for SSL in my development environment.

Also, in the process I found that both of the following wiil work for me.

127.0.0.1 somedomain.com, alternate-domain.com, subdomain.domain.com

or

127.0.0.1 somedomain.com alternate-domain.com subdomain.domain.com

Spaces and commas both work, and I can add multiple domains, subdomains combinations on same line.

Also, if you are moving from a non-secure domain to secure domain/subdomain, SSL certificate needs to be setup on web server for it, else it would end up showing an error in the browser.

Cheers!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top