Title: Modify a hosts file
Author: WordPress VIP Documentation
Published: September 8, 2020
Last modified: October 16, 2025

---

 1. [Domains](https://docs.wpvip.com/domains/)
 2. Modify a hosts file

#  Modify a hosts file

Modifying a [hosts file](https://en.wikipedia.org/wiki/Hosts_(file)) allows a site
to be tested with a new custom domain before the [domain’s DNS has been pointed to VIP](https://docs.wpvip.com/domains/point-dns-to-vip/),
or until the global DNS system has been updated for a domain. Modifying a hosts 
file only affects a user’s local computer, and will need to be repeated on any other
devices that are used for testing.

**Prerequisites**

 * Domains are environment-specific. [The new custom domain must already be added](https://docs.wpvip.com/domains/map-a-domain/)
   to an environment’s Domains panel in the VIP Dashboard.
 * To add a domain to an application’s environment, a user must have at minimum 
   an [Org member role](https://docs.wpvip.com/manage-user-access/vip-dashboard/org-roles/)
   or an [App write role](https://docs.wpvip.com/app-role/) for that application.

A hosts file consists of a list of IP addresses against specific domains. For example:

    ```wp-block-preformatted
    192.0.66.2 example.com
    192.0.66.2 wpvip.com
    ```

In the above example, the domains `example.com` and `wpvip.com` have been modified
to point to `192.0.66.2`, the IP address for a specific environment on the VIP Platform.

In order to update a hosts file for a domain, the domain must already be added to
an environment’s Domains panel in the VIP Dashboard, and the IP address of the environment
must be known.

## Retrieve an IP address

A domain is associated with a specific environment and its IP address after it has
been added to the environment’s Domains panel in the VIP Dashboard.

### VIP Dashboard

DNS instructions are provided for every domain added to an environment’s Domains
panel in the VIP Dashboard. An environment’s IP address can be retrieved from the`
A Record` instructions for a domain.

 1. Navigate to the [VIP Dashboard](https://dashboard.wpvip.com/) for the application
    that the domain is associated with.
 2. Select the environment that the domain will point to (e.g., Production, Develop)
    from the dropdown located at the upper left of the dashboard.
 3. Select “**Domains & TLS**” from the sidebar navigation at the left of the screen.
 4. Select the “•••” button located to the right of the domain.
 5. Select “**DNS Instructions**” from the overflow menu.
 6. The “**Setup your DNS**” panel in the VIP Dashboard provides the values to point
    a domain to VIP using `ALIAS`, `ANAME`, or `A Record`s for root domains, and `CNAME`
    records for subdomains. Retrieve an environment’s IP address from the `A Record`
    instructions (if available) for a domain.

### Command line

If `A Record` instructions are not available for a domain, the IP address for a 
VIP environment can also be retrieved in the command line. In the local machine’s
terminal, run the `host` command against an environment’s [convenience domain](https://docs.wpvip.com/domains-tls/domains/).
For example:

    ```wp-block-preformatted
    $ host example-com.go-vip.net
    example-com.go-vip.net has address 192.0.66.2
    example-com.go-vip.net has address abcd:efgh:ijkl::c000:1234
    ```

## WordPress multisite

For WordPress multisite, in addition to a domain being added to an environment’s
VIP Dashboard, the network site’s Site Address (URL) must be updated to the new 
custom domain. [A network site’s Site Address (URL) can be updated by using the Network Sites launch tool](https://docs.wpvip.com/launch-a-site/begin-a-multisite-launch/).
The launch tool will complete the search and replace process to update the new domain
value throughout the database. Until the domain’s DNS is pointed to VIP, the network
site will only be accessible by modifying the hosts file.

If the network site’s Site Address (URL) is not updated with the new domain, the
updated hosts file will only be able to route the new domain to the network’s main
site (ID 1).

## Edit the hosts file

All modern operating systems make use of a hosts file, but the process for modifying
the file varies slightly for each system.

 * macOS and Linux
 * Windows

 1. Open a Terminal window.
 2. Enter the following command to open the hosts file in a text editor: `sudo nano/
    etc/hosts`.
 3. Enter the root password at the prompt.
 4. Add to the file the IP address and domain needed for testing.
 5. Press `Control+X` then type `y` at the prompt to save the changes.

 1. Press the Windows key.
 2. Type Notepad in the search field.
 3. In the search results, right-click Notepad and select Run as administrator.
 4. From Notepad, open the following file: `c:\Windows\System32\Drivers\etc\hosts` .
 5. Add to the file the IP address and domain needed for testing.
 6. Save the changes.

If the changes are not reflected immediately, clear the browser cache and try visiting
the site again. Remember to revert all of the changes once testing is complete.

Last updated: October 16, 2025