Skip to content

How can I test my live website? (How do I customize my hosts file)

If your website isn’t live yet, but you want to test how it will work in a certain browser, you can always change the hosts file. This file is a text file that is stored on each computer, which you can use to specify which server a particular hostname should refer to.

We will be happy to explain this to you for the two most common operating systems:

Windows and Mac

Windows:

The easiest way to change the hosts file is to use a text editor such as Notepad. Note that you will have to launch it as an administrator. To do this, follow these steps:

  1. Go to your Start menu and search for Notepad. Right-click on the icon and click on "Run as administrator".

  2. You will now be notified whether your Notepad allows you to make anychanges to the computer. Click here on Yes.

  3. Click on File in the upper left corner and select "Open...". In theexplorer you now see where you can enter the path at the top of the screen.

    The path you can enter is:

    C:\Windows\System32\drivers\etc
    

Now you will see the file "hosts". Select this file and click "Open".

  1. In the hosts file you have now opened, you can already see some examples. Below the examples (which always start with #), enter the IP address of the web server where your site is located and enter your domain name as shown below (this information can always be obtained from your project manager or our support department:

    127.0.0.1 voorbeeld.be www.voorbeeld.be
    
  2. Save the file and test it in a browser of your choice.

You should now test the website in an incognito window of your browser (this to avoid caching). If you want to undo the changes, you can go through the same steps as above, but remove the rule you created.

Mac:

  1. To change the hosts file on your Mac, you will need to open the Terminal app. The easiest way to find it is to right click on the Spotlight magnifying glass at the top and search for "Terminal". Double click on it.
    HostsMac01.png

  2. To open the hosts file, you can use the text editor "Nano". Please note that you will need to open it as an administrator. You can perform all these actions by using the following command:

    sudo nano /etc/hosts
    

    If you execute this command, you will be prompted for a password. This is the same password you use to log in to your Mac.

    HostsMac02.png

  3. Once you are in the editor, there will already be some examples. Use the arrows on your keyboard to go down in the document and enter your IP and the desired hostnames on a new line.

    HostsMac03.png

  4. Save the file with the key combination Ctrl + O . You will be asked which file you want to save the changes to. It will already contain /etc/hosts, so you can just press the enter-key. To close the Nano editor, you can use the key combination Ctrl + x.

You should now test the website in an incognito window of your browser (this to avoid caching). If you want to undo the changes, you can go through the same steps as above, but remove the rule you created.

Do you have any questions about this? Do not hesitate to contact us. You can do this by mail to support@dropsolid.com or by phone on 09/395.02.92.