Documentation Index

Fetch the complete documentation index at: https://docs.serversaustralia.com.au/llms.txt

Use this file to discover all available pages before exploring further.

How to edit a computers host file

Prev Next

Sometimes users may be asked or may just need to adjust their local Hosts file for any number of reasons. This is most commonly referred to 'The Host File Method'. Below is instructions on how this can be accessed and edited.

Note: This can only be edited if you have access to log in as a Local Administrator, or have an account with Administrative priviledges.

Overview

The hosts file is a permanent local lookup of IP Addresses and Domain Names. The file is located in the following path:

C:\Windows\Sytem32\drivers\etc\hosts


Warning: 

The hosts file will take precedence over DNS since it is checked first.

If you add an entry for Google.com.au as 127.0.0.1 (loopback), it will be used first.


Editing the Hosts File

The process of editing the hosts file in Windows is straightforward.

The overall steps are

  1. Opening the file in Notepad as an Administrator (there are 3 methods for this outlined below).
    1. Navigating to the file location while logged in as Administrator and selecting 'Open With' then choosing Notepad.
    2. Open via an 'Elevated Command Prompt' and selecting Notepad in the Pop-Up.
    3. Opening Notepad as Administrator and navigating to the file directly.
  2. Editing / Saving the Hosts file itself.
  3. Confirming the changes.


Step 1 - Opening the hosts file

There are three methods to complete this, either one can be chosen to continue:

Method A

(This method requires you to be logged in as an Administrator)

1. Open File Explorer, it is usually found on your Taskbar at the bottom of the screen


2. Navigate to the path  'C:\Windows\System32\drivers\etc\' in the address field


3. Double-click the 'hosts' file and select / double-click 'Notepad' to open it


Method B

1. Using your Start Menu's Search feature, Search Windows for 'Command Prompt', then Right-Click and "Run As Administrator".


2. Using the Paste option (Ctrl + V, or Right-click -> Paste) type in 'start C:\Windows\Sytem32\drivers\etc\hosts' then press Enter
3. Select Notepad in the pop-up

Method C

1. Using your Start Menu's Search feature, Search Windows for Notepad and Right-Click then select "Run As Administrator".


2. Once you have Notepad Open, click on File -> Open, and then navigate to the location of the HOSTS file, by pasting the below path in the bottom bar.
C:\Windows\System32\drivers\etc\

Note: You need to click the drop-down box on the bottom right of the display box and select "All Files" for the hosts file to be visible.

Step 2 - Editing / Saving the Hosts File 

With the file open, you will see a screen like the image below. You will then need to Add a new Line for each website you would like to see. 

Note: Lines starting with a # are commented out and will not be applied. 

Note: If Servers Australia is assisting in a migration for you, you will most likely have a list of sites to paste to the bottom of this file.


1.  Add the required entry/entries 

In this example, we'll add the domain entry:
127.0.0.1 
testing.com


2. Save the updates utilising 'File -> Save' or simply press 'Ctrl + S' on your keyboard

Step 3 - Confirmation

We can now proceed to test the website/s that were being added, it will now bypass DNS and tell your computer to load the website from the IP Address 127.0.0.1
Note: If you have any browsers open, you will need to close them completely and reopen them, as some browsers have DNS caching.