Modify the Local Hosts File
Use your local hosts file to test domain-specific settings and DNS records.
This section provides information on how to modify your local hosts
file.
The hosts
file exists on all major operating systems. The hosts
file provides a list of IP addresses and domains that take precedence over DNS assigned values. You can modify your hosts
file for the following purposes:
- Test domain-specific settings leading up to a migration
- Test DNS records before updates
- 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:
/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.
Configure Your Hosts File with a Local Alias to Your Pantheon Environment
Use
dig
to get the IP address of your Pantheon environment to use in yourhosts
file. Replacedev-example.pantheonsite.io
with your site's domain:dig +short dev-example.pantheonsite.io 203.0.113.42
Edit the
hosts
file as shown below to map the result to an alias for easier local development:203.0.113.42 dev-example