Hosts file windows xp – MacOS – Linux

The HOSTS file takes the structure of the IP address you wish to point to followed by the hostname you are mapping to it. E.g. 45.87.33.76 hostlola.com www.hostlola.com This format remains the same across operating systems, however the location of the hosts file does vary. Here is where you can find it on different operating systems:

  • Windows 95/98/Me: c:windowshosts
  • Windows NT/2000/XP Pro: c:winntsystem32driversetchosts
  • Windows XP Home: c:windowssystem32driversetchosts
  • Windows 7: c:windowssystem32driversetchosts
  • Mac OS X: /private/etc/hosts
  • Linux: /etc/hosts

On Windows Vista they have unfortunately decided to make things more complicated and less accessible, but it’s still possible to make changes to this. You need to edit the file with administrator rights, to do this in Vista:

  1. Start Menu -> All Programs -> Accessories
  2. Right click “Notepad” and choose “Run as administrator”
  3. Click “Continue” on the security prompt
  4. Select File -> Open
  5. Browse to “C:WindowsSystem32Driversetc”
  6. Change the file filter selection from “Text Documents (*.txt)” to “All Files (*.*)”
  7. Select the “hosts” file and “Open”
  8. Make the changes that you require and save the file.

For OS X or Linux you should edit this file with your favourite text editor from the root account. Using this method can save you a lot of headaches in the site development process, and offers you the flexibility to develop your site from anywhere without having to mess about with changing the DNS servers on your web hosting. It also removes the need to consider DNS caching and propagation. This method works for any kind of hosting you have.

Comments

comments