Base de connaissances

How to edit your hosts file on Windows, Mac, or Linux

Editing your local systems hosts file allows you to manually point a website to a specific IP instead of relying on public DNS resolution. The hosts file is located in the following locations depending on your system:

  • Windows 10 – “C:\Windows\System32\drivers\etc\hosts”
  • Linux – “/etc/hosts”
  • Mac OS X – “/private/etc/hosts”

Editing your host file on Windows:

  1. Click the Windows button and type notepad to bring up the notepad utility.

  2. Right click on notepad and click Run as Administrator

  3. You’ll be asked “Do you want to allow this app to make changes to your device?”. Choose Yes.

  4. In your notepad click File and then Open

  5. Navigate to C:\Windows\System32\drivers\etc\hosts or click the address bar at the top and paste in the path and choose Enter.  If you don’t see the hosts file in the C:\Windows\System32\drivers\etc\hosts directory then select All files from the File name: drop-down list, then click on the hosts file. 

  6. Once you're viewing the host file add the entries one per line as needed. The correct format to use is:

    1.2.3.4 hawkhost.com

  7. In the above example replace 1.2.3.4 with the IP address you want to point your site to and replace hawkhost.com with the domain name you're working with.

  8. Once you have added your hosts entries save the hosts file. Your domain(s) will now be manually pointed to the IPs listed in the host file.

Editing your host file on Mac:

  1. Open the Terminal app by using either the Spotlight search or by navigating to Applications=>Utilities=>click Terminal

  2. In the Terminal you just opened type the following command: sudo nano /private/etc/hosts

  3. Type in your user password when prompted

  4. Edit the hosts file using the following format:

    1.2.3.4 hawkhost.com

  5. In the above example replace 1.2.3.4 with the IP address you want to point your site to and replace hawkhost.com with the domain name you're working with.

  6. Save your changes by pressing control-o on your keyboard then return to accept the filename. Exit the editor by pressing control-x. This takes you back to the terminal screen.

Editing your host file on Linux:

  1. From your command line terminal type the following command: sudo nano /etc/hosts

  2. When prompted enter your password to allow your user the ability to modify/save the hosts file

  3. Edit the hosts file using the following format:

    1.2.3.4 hawkhost.com

  4. In the above example replace 1.2.3.4 with the IP address you want to point your site to and replace hawkhost.com with the domain name you're working with.

  5. Save your changes by pressing control-x on your keyboard then y to save the changes and return to complete the save. You will be dropped back to your command line terminal.
  • 0 Utilisateurs l'ont trouvée utile
Cette réponse était-elle pertinente?

Articles connexes

"Please wait while your request is being verified..." message sho...

Our cloud web hosting, semi-dedicated, and reseller web hosting plans utilize Imunify360 WAF (web...

Accessing SpamExperts and creating separate SpamExperts users

All cloud web hosting, semi-dedicated, and reseller hosting services include enterprise level...

Can Hawk Host host international domains?

We can host any TLD that's currently supported by ICANN. We run a clustered DNS setup in...

Can I add more RAM/memory to my hosting account?

RAM/memory upgrades are available on all shared, cloud web hosting, and semi-dedicated hosting...

Can I use ImageMagick?

By default we have ImageMagick installed on all of our servers. When it asks for the path, use...