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 to another site in this workspace, with that site's name. While the domain itself still needs its ownership record, the companion waits for that TXT record too before it connects.

The proof that the domain is yours covers its www hostname, because the companion uses the domain's TXT record. So when a site in another workspace has the www hostname and the domain is verified, or was bought on the workspace's Domains page, that site loses it to this one and stops answering on it straight away, and the message ends with www.example.com was moved here from another site. The tool tells the client to confirm with you first. While the domain is not verified yet, it is refused with www.example.com is used by another Modulify site. Once example.com is verified, add www.example.com again to move it here!, and a domain connected before Modulify asked for the record has to be connected first, with Once example.com is connected in the message.

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, or, for a domain the workspace bought that uses Modulify's nameservers, whether the records Modulify added are in place. On such a domain, the A, AAAA, ANAME and CNAME records already at the hostname it adds are replaced, so whatever they pointed at stops answering there, and the tool tells the client to confirm with you first. 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.