Modify the Local Hosts File

How to find and modify a local hosts file.

Contributors: Alex Fornuto.

Discuss in our Forum Discuss in Slack

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, 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: /etc/hosts
  • Windows: C:\\Windows\System32\Drivers\etc\hosts

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


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

  1. Use dig to get the IP address of your Pantheon environment to use in your hosts file. Replace with your site's domain:

    dig +short
  2. Edit the hosts file as shown below to map the result to an alias for easier local development:    dev-example