Modify the Local Hosts File

How to find and modify a local hosts file.

Contributors: Alex Fornuto.

The hosts file exists on all major operating systems. It's a list of IP addresses and domains that takes precedence over DNS assigned values. You can modify your hosts file to test domain-specific settings leading up to a migration, before DNS records have been updated.

Note that modifying the hosts file usually requires administrative privileges from the OS.

The location of the hosts file varies depending on your operating system:

  • MacOS / Linux: /etc/hosts
  • Windows: C:\\Windows\System32\Drivers\etc\hosts

Add lines to your operating system's hosts file in the following format:

203.0.113.10    example.com
203.0.113.20    www.example.com

In the example above, replace the IP addresses with those provided by Pantheon, and the domains with your own.