github.com/ddev/ddev@v1.23.2-0.20240519125000-d824ffe36ff3/docs/content/users/extend/additional-hostnames.md (about)

     1  # Additional Project Hostnames
     2  
     3  You can add hostnames to a project by editing its [config file](../configuration/config.md#additional_hostnames) or using the [`ddev config`](../usage/commands.md#config) command.
     4  
     5  Use the `additional_hostnames` array in `.ddev/config.yaml`:
     6  
     7  ```yaml
     8  name: mysite
     9  
    10  additional_hostnames:
    11    - "extraname"
    12    - "fr.mysite"
    13    - "es.mysite"
    14    - "it.mysite"
    15    - "*.lotsofnames"
    16  ```
    17  
    18  This configuration would result in working hostnames of `mysite.ddev.site`, `extraname.ddev.site`, `fr.mysite.ddev.site`, `es.mysite.ddev.site`, and `it.mysite.ddev.site`, with full HTTP and HTTPS URLs for each.
    19  
    20  You could accomplish the same thing by running the `ddev config` command:
    21  
    22  ```bash
    23  ddev config --additional-hostnames extraname,fr.mysite,es.mysite,it.mysite,*.lotsofnames
    24  ```
    25  
    26  In addition, the wildcard `*.lotsofnames` will result in anything `*.lotsofnames.ddev.site` being recognized by the project. This works only if you’re connected to the internet, using `ddev.site` for your top-level-domain, and using DNS for name lookups. (These are all the defaults.)
    27  
    28  **Although we recommend extreme care with this feature**, you can also provide `additional_fqdn` entries, which don't use the `.ddev.site` top-level domain. **This feature populates your hosts file with entries which may hide the real DNS entries on the internet, causing way too much head-scratching.**
    29  
    30  **If you use a FQDN which is resolvable on the internet, you must use `use_dns_when_possible: false` or configure that with `ddev config --use-dns-when-possible=false`.**
    31  
    32  ```yaml
    33  name: somename
    34  
    35  additional_fqdns:
    36  - example.com
    37  - somesite.example.com
    38  - anothersite.example.com
    39  ```
    40  
    41  This configuration would result in working FQDNs of `somename.ddev.site`, `example.com`, `somesite.example.com`, and `anothersite.example.com`.
    42  
    43  !!!warning "Don’t use the same `additional_fqdns` or `additional_hostnames` in two different projects."
    44  
    45      If you see `ddev-router` status become unhealthy in [`ddev list`](../usage/commands.md#list), it’s most often a result of trying to use conflicting FQDNs in more than one project. `example.com` can only be assigned to one project, or it will break `ddev-router`.
    46  
    47  !!!warning "May not work predictably everywhere."
    48  
    49      This may not work predictably on all systems. There are operating systems and machines where `/etc/hosts` may not be the first or only resolution technique, especially if the `additional_fqdn` you use is also in DNS.
    50  
    51  !!!warning "Don’t override a real domain name!"
    52  
    53      If you use an `additional_fqdn` that exists on the internet (like `www.google.com`), your hosts file will override access to the original (internet) site, and you’ll be sad and confused that you can’t get to it.