Articles on: General
This article is also available in:

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


๐Ÿ“‹ 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

Was this article helpful?

Share your feedback

Cancel

Thank you!