Modifying your hosts file
โน๏ธ Note: This article is intended to temporarily point a domain name to a specific IP address for personal use.
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
macOS or Linux
Retrieving the IP address via Website Check
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:
Example:
Save the changes.
๐ก To undo the change, simply remove the added line.
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:
or
(Nano is recommended for easier editing.)
Enter your password when prompted and press Enter.
Add the following line at the bottom of the file:
Example:
Save the file:
With Nano: press Control + X, confirm with Y, and press Enter.
With Vi: type :wq and press Enter.
Then run:
๐ก You can undo the change by removing the added line.
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.
๐ฌ Questions? Feel free to contact us!
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
macOS or Linux
Retrieving the IP address via Website Check
๐ 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.
๐ฌ Questions? Feel free to contact us!
Updated on: 23/05/2025
Thank you!