Mondoze Knowledge Base

Search our articles or browse by category below

Windows VPS Hosting Tips On Editing Host File In 4 Steps

Last modified: October 8, 2022
You are here:
Estimated reading time: 1 min

Regardless of the operating system, such as Linux VPS hosting, or Windows VPS hosting, a system’s host file is essential for the operating system to map the hostnames to the IP addresses. For hosting users who are switching to another provider, it is possible to check if their website works properly before moving their domain to another server by editing the host files.

This will be a guide on how to edit your host file on Windows OS. Regardless of Windows OS being Windows 8, 10, or others, aside from the user interface, the directories of the files are likely to be the same. The steps taken to edit the host file for all Windows OS are likely the same too.

Step 1: Run Notepad as Administrator

Firstly, click on the Windows key or search bar and type in Notepad. You should be able to see a list of application options where there is one with “Run as Administrator”. If it’s not there, mouse over the application and right-clicks it to reveal the additional options, then click “Run as Administrator” to run your Notepad instead of the common way to run an application. The reason for running as an administrator is so that you have the right to make changes to the host file.

Step 2: Locating Host File

Click on the File menu that is found on the top right of Notepad then click on the Open option, it will allow you to open a file. Use teh following path to navigate to your host file.

C:\Windows\System32\Drivers\etc\hosts

In the case where the system asks for another way of opening the file, pick Notepad again.

Step 3: Edit Host File

This section is where you will be altering the host file. Remember to make a backup file or be sure to know what you are doing. To point your domain to the new server, add your record in the following format as shown below. Note that this only works for your local machine.

{IP Address} {exampledomain.com} {www.example.com}

An example of how your editor should look is something similar to this.

#     123.0.0.1     localhost

#     ::1           localhost

      123.4.5.6     exampledomain.com     www.exampledomain.com

      123.4.5.6     exampledomain2.com    www.exampledomain2.com

Remember to add both versions of the domain, one without the “www” and one with it.

Step 4: Delete Changes after Test

Finally, revert everything back as before from your backup file or by removing the lines you had added.

Was this article helpful?
Dislike 0
Views: 36