Modifying your hosts file allows you to override DNS settings on your local machine. This is very useful if you are trying to test a site before switching over the global DNS you can do a dry run with just your machine. Essentially by modifying your hosts file we get your machine to resolve the […]
Modifying your hosts file allows you to override DNS settings on your local machine. This is very useful if you are trying to test a site before switching over the global DNS you can do a dry run with just your machine.
Essentially by modifying your hosts file we get your machine to resolve the domain to the specific IP address.
So all we have to do is add the entries for the websites we want to resolve. Lets say we have built our brand new website www.example.com and deployed to its brand new server on IP 11.11.11.11. Therefore to get our machine to go to 11.11.11.11 when we type in www.example.com we need to add the following line to our hosts file:
11.11.11.11 www.example.com
1 | 11.11.11.11 www.example.com |
Windows 10, Windows 8, Windows 7, and Windows Vista use User Account Control (UAC), so Notepad must be run as Administrator.
sudo nano /private/etc/hosts
dscacheutil -flushcache
sudo killall -HUP mDNSResponder
The new mappings should now take effect.
Subscribe to get our best content. No spam, ever. Unsubscribe at any time.
Send us a message for more information about how we can help you