Edit Hosts file to override DNS record for domains

Hosts file will instruct your machine to go directly to an IP address for specified domain instead of checking with DNS server. For example, point www.qualityology.com and qualityology.com to Google Cloud Platform server:

2 www.qualityology.com qualityology.com


For Windows 10, Windows 8, Windows 7, and Windows Vista systems that use User Account Control (UAC).

  1. Run Notepad as Administrator.
    • Press the “Windows” key, type in “Notepad”.
    • Right-click the notepad icon and select: Run as Administrator. OK the UAC prompt.
  2. Open the HOSTS file from Notepad. By default, the Hosts file is located in the C:\Windows\System32\Drivers\etc\ folder.
  3. Edit the HOSTS file and save.

Run the command below in CMD to flush DNS cache.

ipconfig /flushdns

*If you use other programs to edit the Hosts file when you have Windows Defender enabled, Windows Defender may determine incorrectly that the Hosts file was changed by malware, and will automatically remove your modified Hosts file and replace it with the default from Microsoft. You will need to allow hosts file change in Windows Defender, exclude the Hosts file from scanning in Windows Defender. By default, Windows system’s Hosts file is located in the %systemroot%\system32\drivers\etc folder.

  1. Open Windows Defender.
  2. On the Settings tab, click Excluded files and locations.
  3. Under File locations, click Browse.
  4. Locate and then click the Hosts file.
  5. Click Add, and then click Save changes.
  6. Exit Windows Defender.
  7. After everything is done. Go back to Windows Defender and remove the exclusion to secure the hosts file from unauthorized edit.


  1. Open Terminal.

  2. Type

    sudo nano /etc/hosts

    and hit return.

  3. Enter your administrator password and then hit return.

  4. Edit the record or add IP Domain based on your need.

  5. press control and X, and type Y to save and exit.

Run the command below in Terminal to flush DNS cache.

sudo killall -HUP mDNSResponder

Ricoh SP C250DN C252DN PPD CUPS driver for LINUX and macOS Build an extremely fast WordPress with GCP Part 2: Nginx