Modifying your hosts file
By modifying your hosts file, you can locally point a domain name to a specific IP address. This is useful when moving or testing a website without affecting other visitors.
π Windows
Follow these steps to modify your hosts file in Windows:
- Open Notepad as an administrator.
Right-click the Notepad icon and choose Run as administrator.
- Navigate in Notepad to the file path:
C:/Windows/System32/Drivers/etc/
- Change the file type filter at the bottom right from Text Documents (.txt) to All Files (.).
- Open the hosts file.
- Add the following line at the bottom of the file:
[IP-address] [yourdomain.ext] www.[yourdomain.ext]
Example:
192.168.1.1 example.cc www.example.cc
- Save the changes.
π‘ To undo the change, simply remove the added line.
π macOS or Linux
Follow these steps to modify your hosts file in macOS or Linux:
- Open Terminal via the search icon at the top right.
- Run one of the following commands:
sudo nano /private/etc/hosts
or
sudo vi /private/etc/hosts
(Nano is recommended for easier editing.)
- Enter your password when prompted and press Enter.
- Add the following line at the bottom of the file:
[IP-address] [yourdomain.ext] www.[yourdomain.ext]
Example:
192.168.1.1 example.cc www.example.cc
- Save the file:
- With Nano: press Control + X, confirm with Y, and press Enter.
- With Vi: type :wq and press Enter.
- Then run:
dscacheutil -flushcache
π‘ You can undo the change by removing the added line.
π Retrieving the IP address via Website Check
Follow these steps to find your serverβs IP address:
- Visit our Website Check.
- Enter your domain name or server hostname.
- Click the orange Check button.
You will then see a message like:
The domain example.cc points to server dhsX (192.168.1.1).
where 192.168.1.1 is the IP address you should use in your hosts file.
Updated on: 23/05/2025
Thank you!