How to edit hosts files in Windows, Mac, Linux
A hosts entry overrides DNS for one domain on that machine only, so you can test a site on the new server before changing its DNS.
IP domain.com www.domain.com
Example
77.235.XX.XX domain.com www.domain.com
Windows OS
C:\WINDOWS\system32\drivers\etc\hosts
- Go to Start > run Notepad.
- Right click on the Notepad icon and select "Run as administrator."
- Select Open from the File menu option.
- In the File name field, enter the following path: c:\Windows\System32\drivers\etc\hosts
- Add the hostname/domain name and IP address to the bottom of the host file.
For example:
77.235.XX.XX example.com www.example.com
Save the file.
Linux Operating Systems
Hosts file location : /etc/hosts
- Open a Terminal window.
vi /etc/hosts
- Add the destination server's IP address and domain name under the latest entry in the file.
For example:
77.235.XX.XX example.com www.example.com
- Save the host file.
- Reload your browser for the changes to take effect.
MacOS X
Hosts file location : /private/etc/hosts
- Open Terminal and run:
- Type sudo nano /etc/hosts
sudo nano /etc/hosts
- Enter your administrator password
- Add hosts entry with your server IP and domain name.
For example:
77.235.XX.XX example.com www.example.com
- Once you're done, hold down the control and O keys to save the file, then control and X to exit.
Note: You need to run a ping test to ensure that it shows the correct IP. Once testing is finished these entries should be removed.
From the EuroVPS FAQ.
More in how toYour next infrastructure partner
Still have
a question?
Tell us what you are trying to do. An engineer will read it and reply.
+357 222 32280
who will look after your infrastructure.
Let’s start with your setup.
A little context helps us start the right conversation.
