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, or to help with local development.
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:
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.
digto get the IP address of your Pantheon environment to use in your
dev-example.pantheonsite.iowith your site's domain:
dig +short dev-example.pantheonsite.io 203.0.113.42
hostsfile as shown below to map the result to an alias for easier local development: