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
[infobox margin_bottom="0" margin_top="0" border_radius="all" color="white" title=""] iNoobs is a series of articles for those new to web design and web development, created by Zach Katkin, founder of Promana.net, a brilliant resource for small business software news. [/infobox]

So what is this DNS panacea? What simple trick can solve all these problems?

Adjusting Your Local DNS File

iNoobs: The DNS Trick EVERY Developer Must KnowFor 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

  1. 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.”
  2. Open up the host file in windows – C:\Windows\System32\drivers\etc\hosts
  3. 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.
  4. Save the file
  5. Now there’s two things you can do – either restart your computer – or if you don’t want to waste time…
  6. Close your browser
  7. Open up command prompt (CMD in “run”/”search” box)
  8. type “ipconfig /flushdns” (without quotes)
  9. Relaunch browser and visit your website
  10. You’ll now see your server instead of the live site
That’s it… now you can edit and play with your new site to your heart’s content and see the changes immediately. And the rest of the world has NO idea! It looks live, and in a way it is, but because of the way DNS works, nobody can see these changes yet. And when your HorseMagnet.com is just the way you and your client want it you can change the DNS settings for real for the domain and voila! The site is now live to the world!
iNoobs: The DNS Trick EVERY Developer Must Know