So in the Inspired Noob series we’ve been talking a lot about DNS. With that said there was a trick I learned a few years ago (I think it was thanks to my hosting company support). This trick does a number of things:
- Saves countless hours on development
- Removes client intervention/help from the development process
- Allows you to secretly work on ANY website, view the results live and in real time, while the rest of the world is none-the-wiser
So what is this DNS panacea? What simple trick can solve all these problems?
Adjusting Your Local DNS File
For a quick refresher on how DNS works you can review our post on How Does DNS Work? But one thing I purposely left out was that – as a last resort – your computer’s OS stores a DNS file that it uses to resolve (match) domain names to IP addresses. Because it’s local and manually updated, changing or adjusting this file means you can FORCE your computer to look at ANOTHER IP ADDRESS for ANY DOMAIN.
Example in Action
Lets say you’re working on your client’s site at HorseMagnet.com – they want a completely new design AND they want you to host it. But, they’re hosted somewhere else currently. You don’t yet have the information (or the time/desire) to transfer their hosting over. You want to just setup their site on your server and type in HorseMagnet.com and begin working and finalize your design.
By modifying your local host file, this is possible – and easy. You’ll be forcing (in a total violent sexual way) your browser/computer to view your own hosting when typing in HorseMagnet.com.
How to Modify Your Local Host/DNS File
- Open Up Notepad – If you’re on a fancy version of Windows – Vista/7 – you may need to run notepad as an administrator. You can do this by right clicking Notepad’s icon and selecting “run as administrator.”
- Open up the host file in windows – C:\Windows\System32\drivers\etc\hosts
- Edit the file based on what changes you want to enforce. Start with the IP address of the area you’re forcing your browser/computer to look at (probably the IP Address of your server) then *tab* and the domain name you’ll be forcing. Now it’s important to remember that you’ll need to include BOTH www. and non-www versions as each is considered a different location.
- Save the file
- Now there’s two things you can do – either restart your computer – or if you don’t want to waste time…
- Close your browser
- Open up command prompt (CMD in “run”/”search” box)
- type “ipconfig /flushdns” (without quotes)
- Relaunch browser and visit your website
- You’ll now see your server instead of the live site