By modifying the hosts file on your PC you can override the DNS for any number of domains. This is useful if you need to view how a website will look on a particular IP before you update the DNS. When you change web hosting providers, for example or even when you don't want to use a preview link / url.
Just add two entries to the host file with the domain and IP address you want the website to resolve to. For example add this to the file:
The following section provide instructions on locating and editing the hosts file on the following operating systems.
Modify Host File: Windows
- Navigate to notepad, right click and run it as administrator
- Open and go to
- Open the hosts file and make the changes and save
- *flush your DNS if you wish by typing
ipconfig /flushdnsinto Run box
Modify Host File: Linux
- Open a terminal window
- Open the hosts file in a text editor by typing the following line:
sudo nano /etc/hosts
- Enter your domain user password
- Make the changes to the file and press Ctrl + X
- When asked if you want to save your changes, answer y.
Modify Host File: Mac OS
- Open Applications > Utilities > Terminal
- Open the hosts file by typing the following line in the window
sudo nano /private/etc/hosts
- Type your domain user password
- Edit the hosts file
- Save the hosts file by pressing Ctrl + X and answering Y.
- When you are done, please flush your DNS by opening command prompt and typing: