We use cookies
We use cookies to optimize our website. By continuing to browse the site, you agree to our use of cookies.
Control panel
  • Русский
  • Українська
  • English
  • UAH
  • USD
  • RUB
  • EUR
  • 0-800-307-307 Hotline
  • +38 (044) 392-74-33 Kiev
  • +38 (057) 728-39-00 Kharkiv
  • +38 (056) 794-38-31 Dnipro
  • +38 (032) 229-58-93 Lviv
  • +38 (048) 738-57-70 Odessa
  • +38(093) 170-15-42  Life
  • +38 (067) 400-88-44 Kievstar
  • +1(888)393-24-51  USA, Toll free
  • +44(131)507-01-14  Great Britain
  • +7 (499) 348-28-61 Moscow

2.37. Editing hosts

File hosts used by the operating system to determine the address of certain resources instead of requesting DNS... If the address of a certain resource is specified in the hosts file, the request will not be sent to DNS-server for receiving domain data, when opening a domain - it will open exactly from the address specified in the hosts file. The use of this file is quite convenient for testing the operation of a site from another server without directing the domain directly to this server.

Usually the file is located along the path C:/Windows/System32/Drivers/etc/hosts or %SystemRoot%\system32\drivers\etc\hosts, but it can be changed in the registry.

You can use a registry editor to check the path to the hosts file. To do this, you need to click on Win+R, enter regedit and click "OK". The required parameter can be found along this path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\DataBasePath.

To quickly open a file with administrator rights, you need to click Win+R, specify the path to the file C:/Windows/System32/Drivers/etc/hosts and holding the buttons Ctrl+Shift, click on "OK».

Usually the file is located along the path /etc/hosts... On some operating systems, the path may differ.
The path may be different depending on the OS version.

On macOS 9 and earlier, the file is located in the system directory or a subdirectory of it preference... On macOS 10 and later, the file is located in /private/etc/hosts or /etc/hosts1).

In Android, the file is located along the path /system/etc/hosts.
On iOS, the file is located along the path /private/etc/hosts.

The hosts file contains entries in the form IP domainbetween which a tab should be set (to indent, just press Tab), everything after the symbol #is considered a comment:

In this example, there are three entries:

  1. Direction localhost on IPv4 (appeal to localhost Is an appeal to oneself).
  2. Direction localhost on IPv6 ::1 (equivalentto 0:0:0:0:0:0:0:1).
  3. Example direction example.com on IPv4 XXX.XXX.XXX.XXX.

/etc on OS X is a symbolic link to /private/etc.