Difference between revisions of "Edit your hosts file"

From Freephile Wiki
Jump to navigation Jump to search
(Created page with "First a little backgrounder: All websites have an address. I don't mean the domain name (example.com), I mean the IP (Internet Protocol) Address such as 10.10.3.1 The mappin...")
(One intermediate revision by the same user not shown)
Line 6: Line 6:
  
 
* [http://www.mactip.net/how-to-edit-the-hosts-file-on-a-mac/ edit your "hosts" file in Mac]
 
* [http://www.mactip.net/how-to-edit-the-hosts-file-on-a-mac/ edit your "hosts" file in Mac]
* For Windows, open Notepad as administrator and edit '''<code>C:\Windows\System32\drivers\etc\hosts</code>'''. You might also need/want to [https://help.dreamhost.com/hc/en-us/articles/214981268-Flushing-your-DNS-cache-in-Windows flush your DNS cache]
+
* [http://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/ How-To Geek describes the procedure for all operating systems]
  
 
[[Category:System Administration]]
 
[[Category:System Administration]]
 
[[Category:Help,Howto,Development]]
 
[[Category:Help,Howto,Development]]

Revision as of 09:49, 19 March 2014

First a little backgrounder: All websites have an address. I don't mean the domain name (example.com), I mean the IP (Internet Protocol) Address such as 10.10.3.1 The mapping of domain names to IP Addresses is something which is handled by the DNS system. DNS, or Domain Name Service is like the phone book for the Internet. Every time you "call" a website (eg. facebook.com), your computer asks DNS which IP address that website lives at. With the domain translated to IP, your request gets routed across the internetwork of computers so that a response comes back (usually in the form of some lolcat or selfie).

As a web developer, you invariably end up working on new versions of websites that are not publicly visible -- at least not at the 'official' address. Once the preparations are done and everything is fully baked, you have to switch on the new site. How do you get the "beta" site developed when all the links and images etc. have to look and feel exactly as if they were the real thing? The answer is the "hosts" file on your computer. Using the hosts file, you can tell your computer that example.com lives at any IP address you want, including the "localhost" address of 127.0.0.1

If you ever need to work on sites before they are live, you'll need to modify the hosts file on your computer. Instructions are a bit different depending on the Operating System you're using: a Linux computer, MacOSX, or Windows.