How to update your hosts file.

Posted in Notes on 24 August 2017

Every computer has a file on it which allows the owner to specify where a website is loaded from. A hosts file is a simple combination of domain names and IP addresses.

Adding a record to your hosts file means your computer will load the domain using the IP address specified, rather than the one provided by DNS.

111.222.333.444 www.domain.com
111.222.333.444 domain.com
111.222.333.555 subdomain.domain.com

Windows

  • Press the Windows key
  • Type Notepad
  • From the results, right click on “Notepad” and choose “Run as administrator”
  • From Notepad load the file C:\Windows\System32\Drivers\etc\hosts
  • Enter the IP address, followed by a space or tab, and the domain
  • Save the changes
  • Exit Notepad

Linux

  • Open a terminal window and enter sudo nano /etc/hosts.
  • Enter your password if prompted
  • Enter the IP address, followed by a space or tab, and the domain
  • Ctrl+O to save
  • Ctrl+X to close

MacOS X

  • Open a terminal window and enter sudo nano /etc/hosts.
  • Enter your password if prompted
  • Enter the IP address, followed by a space or tab, and the domain
  • Ctrl+O to save
  • Ctrl+X to close

Related Notes Posts

February 2024

Animated SVGs (Scalable Vector Graphics)

Animated SVGs, Scalable Vector Graphics, are increasingly popular choices for adding dynamic elements to websites. Their scalability, lightweight nature, and flexibility make them attractive options... Continue reading

December 2023

Using Scalable Vector Graphics (SVGs)

Scalable Vector Graphics (SVGs) have revolutionised website design, offering unparalleled flexibility, scalability, and interactivity. As versatile graphic elements, SVGs can enhance the visual appeal and... Continue reading

September 2023

Designing websites for accessibility

In the ever-evolving landscape of web design, the balancing act between accessibility and aesthetic appeal remains a crucial consideration. As the digital realm becomes increasingly... Continue reading

More Notes Posts