Using the host file for testing website


The host's file can be termed as the special file which is on the workstation computer that will be storing the IP and the name information. This is the type of file which is checked before the DNS, hence if you are placing an entry in the file then it will be supersede anything which is set on the DNS. This type of feature is very useful in testing the websites as it will be allowing the user to control the IP the local computer will be visiting regardless of what has been set up in the DNS.



 

The format of the hosts file is very much simple. Here each line will be having an IP address and a hostname which is being separated by one or more spaces. Hence the host file will typically be containing the entries for “localhost” as well as it will contain some comment text which describes the file and its usage. Hence it would be best if there are no changes done in any of these lines.

Examples have been shown below:

1.2.3.4 example.com
1.2.3.4 www.example.com

Editing the hosts file for Windows

From the start menu, search for “Notepad” (Win 8,10) or you need to navigate to "All Programs -> Accessories -> Notepad" (Win XP, Vista, 7).

Now you need to right click on the notepad and then select the “Run As Administrator”.

Now in the notepad, you need to click “OPen” and then select the file C:\Windows\System32\Drivers\etc\hosts.

Now you can edit and save the file.


Editing the hosts file for Linux

You need to open a terminal window for Linux
Now edit the file /etc/hosts as root with a text editor. One of the example has been shown below

sudo nano /etc/hosts


Testing the settings

You need to Open a command prompt

Now you need to use the command -c2 example.com

Now the ping result will show the IP address and confirm that it is responding.

So today if you are looking to host your website on a cloud server and if you are looking for the best cloud hosting provider for your website then here at HostingRaja we provide with best in the class cloud server for you at an affordable price. Not only that here at HostingRaja we have years of experience in providing top class cloud services for our customers. Here at HostingRaja we also provide amazing offers, features, and discounts on our cloud server. We also provide managed cloud hosting service so that you can focus on your website and we will take care of your website and hosting related issues. Not only that we also provide 99.9% network uptime with 24/7 customer support via phone, chat, email and ticket system.