Editing the Hosts files to change DNS by hand
Sometimes it is required to change the DNS (name that points to the IP address) for a site. This usually happens when moving servers or trying out test websites. For example, I have been moving about 30 Wordpress sites to a new server for consolidation, I need to test the new destination without changing the main DNS, because I may have done something wrong and the main site will now become inoperative, or BROKE as we say in the business.
If you use normal computers, anything based on Unix, then its pretty easy. Good thing you are smart enough to use a Mac or Linux. If you are one of the smart ones then all you need to do is edit the /etc/hosts file and add a line with the new IP address and DNS name. Lets say our new IP address is 10.3.2.1 because its on a local network and your website is SmartPeopleUseUnix.com. Then edit your /etc/hosts file with a new line:
10.3.2.1 smartpeopleuseunix.com www.smartpeopleuseunix.com
Usually "sudo vim /etc/hosts" will do the trick. When you are done you can just put a hash sign (pound sign, #) in front of it all to comment it out.
Lets say your are not one of the smart people and you use the only operating system that this does not work on! Sort of easy, just open notepad as an administrator, open %systemroot%\system32\drivers\etc\ notice the backward slashes. Hey look at me I am VMS machine. %systemroot% is usually c:\windows. Have fun with notepad. Or you may be one of the smart ones forced to use Windows and you installed Cygwin on the machine and you could use vim there as well.
OR much easer use the HostsMan software right here http://www.abelhadigital.com/hostsman and instal this software to make the changes.
Please sign in to leave a comment.