How to access an unmapped domain on the Internet by editing the hosts file on your computer in Windows, Mac and Linux

Il file hosts allows you to map a domain to a specific IP address, bypassing DNS. By editing this file, you can make your computer access a specific domain (even if not yet mapped to the internet) by pointing it to a local IP address or test server.

To proceed you must know the server IP and, obviously, the domain name.
For example, if you have a cpanel with dominiomio.com but the domain has not yet been purchased or its DNS connects it to another server, to view what is present in the cpanel, you must modify the hosts file as described below.

**Here's how to edit the file*hosts* on Windows, macOS and Linux:**

🖥 Windows

  1. Open Notepad as administrator:
  • award Win + S, type Blocco note (o Notepad).
  • Right-click on Notepad and select Run as administrator.
  1. Open the hosts file:
  • From the menu File > Open.
  • Go to this directory:
    C:\Windows\System32\drivers\etc\
  • Select the file hosts. (Make sure to choose “All Files” in the opening window.)
  1. Edit the file:
    Add a new line with the following syntax:
   <IP_del_server> <nome_del_dominio>

Example:

   192.168.1.100 www.miosito.local

Like this, typing www.miosito.local in the browser, your computer will access the local server with IP 192.168.1.100.

  1. Save the file:
  • award Ctrl + S to save.
  1. Clear your DNS cache (optional but recommended):
  • Open Command Prompt as administrator (cmd) and type:
    ipconfig /flushdns

🍏 macOS

  1. Open Terminal:
  • Go up Applications > Utility > Terminal.
  1. Edit the hosts file:
  • Type the command:
    sudo nano /etc/hosts
  • Enter your administrator password if required.
  1. Add a new line:
   <IP_del_server> <nome_del_dominio>

Example:

   192.168.1.100 www.miosito.local
  1. Save and close:
  • award Ctrl + O, Then Invio to save.
  • award Ctrl + X to exit the editor.
  1. Clear your DNS cache:
  • Type in Terminal:
    sudo dscacheutil -flushcache sudo killall -HUP mDNSResponder

🐧 Linux

  1. Open Terminal.
  2. Edit the hosts file:
  • Type:
    sudo nano /etc/hosts
  1. Add a new line:
   <IP_del_server> <nome_del_dominio>

Example:

   192.168.1.100 www.miosito.local
  1. Save and close:
  • award Ctrl + O, Then Invio to save.
  • award Ctrl + X to exit the editor.
  1. Clear your DNS cache:
  • It depends on the distribution, but common commands are:
    sudo systemctl restart systemd-resolved
    or:
    sudo /etc/init.d/networking restart

🛠 Important Notes:

  • Backup del file hosts: Before modifying it, it is always advisable to make a copy of the original file.
  • After the change, if it doesn't work immediately, try restarting your browser or the entire system.
Facebook
Twitter
LinkedIn
Reddit
Print
Email

Questions or ideas?

Your email address will not be published. Required fields are marked *

Easy Green Hosting



Or..

Leave your contact.

Spirit of the World – Blue

Spiritus Mundi has already completed the planting of thousands of trees, creating real urban forests.

Since the beginning of summer 2021, we have financed the planting of 80 trees in the Bosco Vivo di Legnaro.

EnvironmentWater – Lombardy

With Ambiente acqua we gave life to the planting project of the Parco Est delle Cave, with a first planting in October 2021 of 101 trees.

Treedom

Our very first commitment to reforestation begins with Treedom, with which we financed the planting of 60 trees at the beginning of 2021.

DEMO CPANEL

Explore the dashboard
n.1 in the world