Before proceeding to edit the hosts file it is recommended to backup and make a copy of the file to a different location on your computer just in case you need to revert the changes.
The hosts file is a file that your operating system uses to map hostnames to IP address. Modifying this file will allow you to manually setup dns records to point a web address to a different IP such as for test purposes when setting up an existing website on a new server before moving the DNS records to the new server.
If your PC is a Windows machine.
To edit your “Hosts” file you will need to follow these steps:
- Browse to the following location :
C:\Windows\System32\drivers\etc - Please note that “C:\ “ is the default drive that Windows is normally installed on, however this may differ depending on the system and install.
- Then click on “hosts” and click on “open” using notepad or any edit tool.
- At the bottom of the file you can add the IP first and then press the space bar and enter the website url.
Example: 123.123.123.xx mywebsiteurl.com - Then save the file by clicking “File”, then “Save”.
- Then close the file and test the url in your web browser
If your PC is a Linux/Unix machine.
To edit your “Hosts” file you will need to follow these steps:
- Open
/etc/hosts - At the bottom of the file you can add the IP first and then press the space bar and enter the website url.
Example: 123.123.123.xx mywebsiteurl.com - Then save the file by clicking “File”, then “Save”.
- Then close the file and test the url in your web browser
