Anyone who ever worked on a web application knows waiting for DNS to propagate sucks. You’ve setup an app or site to use a certain domain but have to wait for 24 hours? That’s a lot of wasted time. Or perhaps you want to test something with a fake domain name?
Well, fret no more, because if you edit your host file on Windows, you can easily map domains to IP addresses until DNS does it’s job. In this tutorial we’ll explain how it’s done in a few simple steps.
How it’s done
Important notice: You need Administrator rights on your device to edit your host file. If you don’t have Administrator rights… Well, we can’t help you with that. Sorry!
Open the Command Prompt as an Administrator:
- Open Start
- Typing “cmd” will reveal “Command Prompt” as an option.
- Click “Run as administrator”
Once the terminal is open, type the following command:
Notepad will open, containing your hostfile.
Mapping new domains to IP addresses is very simple. Start a new line, write the IP address, followed with a space and the domain name you want to map to the IP. Like we said, this can be a custom domain. That means it doesn’t really have to exists. For example, if you’re coding an awesome app and want to use gregg.isawesome as a domain name, you can.
Once you are done editing the file, remember to save it. To check if your host file is working, you can try to ping the domain name you just mapped.