One of the most powerful tools available to anyone working on their site during a migration is their computer’s “hosts” file. The hosts file is used to map domain names to IP addresses, and can be used as an alternative to DNS. It also allows you to specify the IP address to which a website resolves on your computer, regardless of what may be published in the site’s DNS zone file.
Modifying your hosts file lets you view and test a site on one server while the rest of the world continues to see the site on another. That makes it an essential tool when migrating your website. With this method, you’re able to ensure that:
It’s actually a very simple process. Let’s take a look at an example hosts file:
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
123.123.123.123 liquidweb.com www.liquidweb.com
In this case, the first three entries are defaults used to configure the local network interface. You may have more or less local entries in your hosts file. You do not need to worry about them other than to note their presence. Any custom entries will go at the bottom of the file, and in this case, you can see that we have added a custom entry to the end of the file already:
123.123.123.123 liquidweb.com www.liquidweb.com
My custom entry specifies that any request made from my computer (via a web browser or SSH, email, or FTP client) for liquidweb.com or www.liquidweb.com will be directed to the IP address I’ve specified: 123.123.123.123. To redirect your specific request, you must add your own custom entry to the end of your file using the same format.
The line for your custom entry will consist of three elements.
If you’re migrating to a Liquid Web server, your migration technician will supply you with the information to add. Simply copy and paste the line into your hosts file. If your migration involves multiple IP addresses, you will have one line for each IP address, regardless of how many domain names share it.
#getting started #tutorials #apple #dig #dns #hosts #hosts file #linux