How to Temporarily Access a Website Using a Local DNS (Hosts File) Print

  • hosts file, local DNS override, temporary DNS access, access website before DNS propagation, DNS propagation testing, test website before nameserver change, preview website on new server
  • 0

Windows Instructions

  1. Open Notepad as Administrator
    • Click Start
    • Search for Notepad
    • Right-click and select Run as Administrator
  2. Open the hosts file located at:
    C:\Windows\System32\drivers\etc\hosts

    If you do not see the file, change file type to "All Files".

  3. Add the following lines at the bottom:
    123.123.123.123   example.com
    123.123.123.123   www.example.com
  4. Save the file.

Linux Instructions

  1. Open Terminal.
  2. Edit the hosts file:
    sudo nano /etc/hosts
  3. Add the following lines at the bottom:
    123.123.123.123   example.com
    123.123.123.123   www.example.com
  4. Save and exit:
    • Press CTRL + X
    • Press Y
    • Press Enter

macOS Instructions

  1. Open Terminal.
  2. Edit the hosts file:
    sudo nano /etc/hosts
  3. Add the following lines at the bottom:
    123.123.123.123   example.com
    123.123.123.123   www.example.com
  4. Save and exit:
    • Press CTRL + X
    • Press Y
    • Press Enter

Was this answer helpful?

« Back