How to edit hosts file - locations for Windows Linux and Mac Print

  • 3

Before making DNS changes, you should test your website on the new server. In order to do this, you can modify your system's hosts file. This will trick your system into thinking the IP address of your website is that of the new server and you can see how your site behaves exactly as if you had made DNS Changes.

Here are the locations of hosts files on various operating systems:
Mac/Linux/Unix /etc/hosts
Windows 3.1/95/98/ME c:\windows\hosts
Windows NT/2000/XP Pro c:\winnt\system32\drivers\etc\hosts or c:\windows\system32\drivers\etc\hosts
Windows XP Home c:\windows\system32\drivers\etc\hosts
Windows 7,8,10,11 c:\windows\system32\drivers\etc\hosts

NOTE: For Windows 7, 8, 10 and 11, you must edit the hosts file as an Adminstrator. Open notepad as an Adminsitrator by clicking Start, then search for notepad. Right click notepad in the search results then select "Run as an Administrator". Then click file/open and browse for your hosts file.

NOTE: For Macs, click search, then run Terminal
Type: sudo nano /etc/hosts
Type in your password
You can then edit the hosts file
CTRL X to exit
W to save
Change is instant.

Add the following lines to your hosts file with the format:
IP ADDRESS www.yourwebsiteurl.com
IP ADDRESS yourwebsiteurl.com

For example
192.34.55.134 www.entirelydigital.com
192.34.55.134 entirelydigital.com

Then save.

Clear your browser cache and then surf to your site.


Was this answer helpful?

« Back