Skip to content
xYnta
Go to websitexynta.com
Search
EN

Editing your hosts file

Updated on

In your computer's hosts file you set which IP address a domain name points to, for your own computer only. Useful when you migrate a website and want to test it on the new server while other visitors still see the old website.

Your server's IP address

You need the IP address of the server your package is on. Your server name is shown in Mijn xYnta with your hosting package; see How can I find the server name of my hosting package?

In Command Prompt (Windows) or Terminal (macOS and Linux), type this command and press Enter:

nslookup dhs1.srvnl.nl

Use the address with dots (IPv4) below the line with Name, for example 185.117.226.70; not the address of the DNS server at the top of the output. You can also enter dhs1.srvnl.nl in the website check. The examples below use 192.0.2.10; replace it with your server's IP address.

Windows

  1. Open Notepad as administrator

    Right-click Notepad and choose Run as administrator.

  2. Open the hosts file

    Choose File › Open and go to the folder C:\Windows\System32\drivers\etc. At the bottom right, set the file type to All Files (*.*) and open the file hosts.

  3. Add the line

    At the bottom of the file, add a line with the IP address and your domain name, with and without www.:

    192.0.2.10 yourdomain.nl www.yourdomain.nl
  4. Save the file

    Choose File › Save.

macOS and Linux

  1. Open Terminal

    On a Mac: click the magnifying glass at the top right, type Terminal and press Enter.

  2. Open the hosts file

    Type this command, press Enter and enter your computer's password:

    sudo nano /etc/hosts
  3. Add the line

    At the bottom of the file, add a line with the IP address and your domain name, with and without www.:

    192.0.2.10 yourdomain.nl www.yourdomain.nl
  4. Save the file

    Press Control + X, then Y and Enter.

  5. Flush the DNS cache (macOS only)

    Type this command and press Enter:

    sudo dscacheutil -flushcache

Related articles