I have set up a linux machine with webserver and this and that on my local network.
I want to be able to set up a test domain such as test.com and be able to access it from other machines on the local network without having those machines hit the internet and finding the real test.com site.
where the ip address is the address you have the test site running on, and the domain.com is the domain name you wish to access the test site with. You can add several "aliases" separated by spaces on the line, if there is more than one hostname you wish to use for that ip address, such as with and without the www.
You will probably need to restart your browser to get it to pick up changes in the file. When you get done testing and want to revert back to the "real" DNS, just remove the line(s) from the hosts file.
Also, the hosts file is named just that... "hosts" so make sure you don't edit hosts.sam or any other file to accomplish this.
The hosts.sam(ple) file is a sample of what you want, but you don't really need anything in the file other than the line like I posted earlier. So you can just create a new text file named hosts (In your "Save As..." dialog box put the filename hosts in quotes to keep NotePad from automatically adding the .txt extension) or you could open hosts.sam and save as hosts the same way, after adding the lines you wish.