Add the www companion domain
add_www_domain
Adds the www version of one of a site's custom domains, so the root and the www address both reach the site.
Usually you do not need it, because add_custom_domain and verify_domain already attach the www companion for a root domain. Reach for it after remove_www_domain, or when get_domain_status shows no companion on a root domain because the automatic attempt did not complete.
It requires a paid plan and the Manage domains permission. The companion only exists for root domains, so a domain that is itself a subdomain is refused, and so is one that already has a companion or whose www hostname already belongs to this site or another one.
When the domain is itself the www hostname, because its root was removed, it adds the root back instead. When the hostname it adds is the domain waiting on verification, that pending verification is cleared.
Like the domain itself, the companion is not live until its DNS records are in place, so call get_domain_status afterwards to read what to add. See www and apex domains.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
projectId |
string | Yes | The site id. |
domainId |
string | Yes | The _id of the custom domain to add the www companion to, as get_domain_status or add_custom_domain returned it. The companion is derived from that domain. |