How do I edit a host on Windows or Mac?

Procédure

What is a hosts file?

A hosts file is used toassociate a host name or domain name with an IP address. Changes made to this file are taken into account immediately after the change. This file is available on all operating systems.

I. What you need to know before modifying your computer's Hosts file

The Hosts file is designed to make your computer think that your domain name is pointing to a specific hosting. This will not cause your domain name or your website to malfunction on its current hosting. Only you will see the changes. Other visitors will see your website on its current hosting.

Setting up a configuration in the hosts file may require you to purge the browser cache files after each operation so that everything is fully functional and you can see your site at LWS or on its current hosting.

As your domain is not yet actually pointing to your LWS hosting, the SSL certificate cannot be installed and you will certainly have to ignore your browser's security warnings. Don't worry, once your domain redirects to our hosting, the certificate will be functional and your domain will be secured in HTTPS.

II. What settings should I add to my Hosts file?

The settings line to be added to a Hosts file looks like this:
XXX.XXX.XXX.XXX domain.tld www.domaine.tld

XXX.XXX.XXX.XXX is the IP address of the web server for your LWS package, so you'll need to replace this with the real IP address of the LWS server.

domain.tld is a generic entry for your domain name, so replace it with your real domain name.

The purpose of this entry in the Hosts file is to tell your browser that the domain you have entered (with or without www) refers to the IP you have entered and not the usual IP.

To find out which IP to enter, please follow this documentation. Only the WEB service IP is required.

III. How do I modify hosts on Windows?

A. Manual handling

The hosts file is located on the following path:

C:\WINDOWS\system32\drivers\etc\hosts

The first thing to do is to open a text editor such as Notepad or Word, in administrator mode (right-click then run as administrator).

Once the text editor is open, go to File -> Open and navigate to the hosts file (C:\WINDOWS\system32\drivers\etc\hosts).

Then insert the line of the hosts you wish to add: for example: 4.39.504.987 monsite.com www.monsite.com

Once this has been done, your file should look like this:

 Copyright (c) 1993-1999 Microsoft Corp.# # This is an example of the HOSTS file used by Microsoft TCP/IP # for Windows.                 
# This file contains mappings from IP addresses to hostnames.                 
# Each entry must be on its own line. The IP address should be placed # in the first column, followed by the corresponding hostname. The # IP  address  and hostname must be separated by at least one space.                 
# # In addition, comments (such as this one) can be inserted on  their own # lines or after the computer name. They are indicated by the # symbol '#'.                 
# For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # client host x 127.0.0.1 localhost4.39.504.987 monsite.com www.monsite.com

Then save the modification.

The change will take effect immediately.

B. Handling with the Microsoft PowerToys utility

Go to the download page for the PowerToys utility published by Microsoft and available from their Store.

Then click on"Install".

How do I edit a host on Windows or Mac?

Click on the "Install" button in the window that appears next

How do I edit a host on Windows or Mac?

Once the application has been installed, open it and select"Host File Editor" from the left-hand menu.

How do I edit a host on Windows or Mac?

Then click on the"Launch Host File Editor" button.

How do I edit a host on Windows or Mac?

A warning message will appear. You must accept this message to proceed.

How do I edit a host on Windows or Mac?

Then click on"+ New entry" ...

How do I edit a host on Windows or Mac?

... and enter the required parameters before clicking on"Add".

How do I edit a host on Windows or Mac?

You will then just need to leave the option activated to view your site with LWS, or deactivate it to view it with your current host.

How do I edit a host on Windows or Mac?


IV. How do I modify a host on a Mac?

1. Open Terminal

Open theMAC search tool "Spotlight" using the command :

CMD + SPACE

How do I edit a host on Windows or Mac?

2. Open the Hosts Mac file via the terminal

Once your terminal is open, type the following command line:

sudo pico /etc/hosts

then press ENTER

Enter your Mac session password.
/It will not appear in the terminal, so type your password in full and press ENTER.

3. Modify your Hosts file

Use the arrows on your keyboard to make the necessary changes to your hosts file.

How do I edit a host on Windows or Mac?

4. Save your changes

To save your changes and exit the application, use the following commands:

CTRL+O (^O) to save your changes, then click "ENTER".
CTRL+X (^X) to exit the hosts file. You can now close the terminal application.

All you have to do now is exit your terminal. The hosts file has now been modified on your Mac.

Conclusion

You can now modify a hosts file on Windows or Mac with LWS. You can modify and/or delete the Hosts file at any time.

Don't hesitate to share your comments and questions!

Rate this article :

4.2/5 | 6 opinion

This article was useful to you ?

Article utileYes

Article non utileNo

Vous souhaitez nous laisser un commentaire concernant cet article ?

Si cela concerne une erreur dans la documentation ou un manque d'informations, n'hésitez pas à nous en faire part depuis le formulaire.

Pour toute question non liée à cette documentation ou problème technique sur l'un de vos services, contactez le support commercial ou le support technique

MerciMerci ! N'hésitez pas à poser des questions sur nos documentations si vous souhaitez plus d'informations et nous aider à les améliorer.


Vous avez noté 0 étoile(s)

Similar articles

0mn reading

Explicit TLS FTP connection

1mn reading

How to clear my google chrome browser cache

0mn reading

How to disable TLS on FileZilla

1mn reading

Site error during installation


Questions sur l'article
Alexandro Il y a 92 days
ne fonctionne pas comme cela est dit pour Mac
See the
1 answers
Jordan-LWS - Il y a 90 days

Bonjour,

Je vous remercie pour votre message.

Je suis désolé que vous ne soyez pas en mesure de modifier votre fichier hosts correctement. Si vous souhaitez tenter une alternative, je vous invite à essayer ce site internet qui devrait répondre à vos besoins.

Suivez ces quelques étapes une fois sur le site internet :

  1. Dans Preview, laisser par défaut (the regular website)
  2. Ajouter l'adresse IP de votre serveur web dans le champ de hosted on, IP que vous pouvez retrouver directement en suivant notre documentation
  3. Dans le champ under saisissez votre nom de domaine
  4. Laisser par défaut le champ over
  5. Valider avec Go

Je vous remercie pour votre attention et reste à votre disposition pour toute autre question ou complément d'information.

Cordialement, L'équipe LWS

Utile ?

Ask the LWS team and its community a question