The “hosts file” location in windows server/system – Add hosts entry in Windows

Hey, it’s very useful in some situations where you have to point the domain to your test server. For example, if you want to point your domain “test.com” to your “test server” temporarily, what do you do for this ? You can simply edit your local machine’s hosts file to point that doain to your test server, because the basic search for DNS is starting from the “hosts file” of local machine. In Unix based system the hosts file is located under the “/etc” [/etc/hosts] directory. In windows it is quit different. The default location for the hosts file in Windows is pasted below:

Localdisc(C) >> Windows >> System32 >> drivers >> etc

See this image for more clarification;

How to point test domain to test server ?
Yes, for this, add this line to your hosts file:

xx.xx.xx.xx    test.com

Where xx.xx.xx.xx is the test server’s IP address.

That’s it.

Post navigation

Arunlal A

Engineer. Linux enthusiast. Traveller. DevOps learner and practitioner. I enjoy working with Linux, DevOps, automation, and technology while exploring new places along the way. I use this space to share my experiences, learnings, experiments, and things I discover along the journey. Whether you're a seasoned DevOps professional or just getting started, let's connect, learn, and grow together. Happy coding, automating, and deploying!

Leave a Reply

Your email address will not be published. Required fields are marked *