---
title: Custom domains
subtitle: Point your domain at ButterIX with a CNAME and prove you own it with a TXT record. Once verified, the platform issues an HTTPS certificate automatically and the domain serves the site's production deployment.
description: Set up a custom domain for a ButterIX hosted site — adding the domain, the CNAME to sites.butterix.com, _butterix TXT ownership verification, automatic HTTPS certificates and renewal, multiple domains, deploying under a subpath, and FAQ.
---

Every site already has a default URL, `https://<subdomain>-sites.butterix.com`. Once you connect a custom domain (such as `docs.acme.com`), both addresses work and point to the same production deployment.

## Setup

<Steps>
  <Step title="Add the domain">
    In the organization console (`https://console.butterix.com`), open the site's "Domains" tab, click "Add domain", and enter the full domain, e.g. `docs.acme.com` (requires the admin role). Pasting a URL with `https://` or a path also works — the platform strips the extra parts.

    A domain can be connected to only one site, and the total number of domains an organization can connect is limited by its [quota](./platform.mdx#quotas-and-usage).
  </Step>
  <Step title="Add the CNAME record">
    At your DNS provider, add a CNAME record pointing the domain at ButterIX:

    | Type | Name | Value |
    |---|---|---|
    | CNAME | `docs` (i.e. `docs.acme.com`) | `sites.butterix.com` |
  </Step>
  <Step title="Add the TXT record">
    Then add a TXT record to prove you own the domain. Use the token shown in the console:

    | Type | Name | Value |
    |---|---|---|
    | TXT | `_butterix.docs.acme.com` | `butterix-verify=a1b2c3d4e5f6…` |

    Some DNS providers only want the part before your root domain in the "Name" field; in that case, enter `_butterix.docs`.
  </Step>
  <Step title="Verify">
    Back in the console, click "Verify". The platform looks up the TXT record at `_butterix.<your domain>`; when it matches, the domain is marked "Verified" and starts serving the site immediately.

    DNS changes can take anywhere from a few minutes to a few hours to propagate; if verification fails, just try again later.
  </Step>
  <Step title="HTTPS is enabled automatically">
    After verification, the platform issues an HTTPS certificate for the domain through Let's Encrypt, usually within a minute or two — you don't need to upload or configure anything. Certificates renew automatically 30 days before they expire.
  </Step>
</Steps>

## Via the API

<EndpointRequestSnippet endpoint="POST /sites/{site}/domains" languages={["curl"]} />

<EndpointResponseSnippet endpoint="POST /sites/{site}/domains" />

In the response, `verifyRecord` is the TXT record to add and `cname` is the CNAME target. Once the records are in place, call [Verify domain](/api-reference/domains/verify-domain).

## After activation

- The custom domain and the default `<subdomain>-sites.butterix.com` address both work and point to the same production deployment.
- A site can have several custom domains; each one is verified separately.
- **Primary domain**: canonical URLs, the sitemap, `robots.txt`, `llms.txt`, feeds, and `.md` pages use the primary domain for absolute URLs. By default it is the most recently verified custom domain, once its HTTPS certificate is active. To use another one, click "Make primary" in the "Domains" tab (or call [Set primary domain](/api-reference/domains/set-primary-domain)); domains you add later then no longer take over. Without a custom domain, the default URL is used.
- When the primary domain changes, the platform redeploys the version that is live, and absolute URLs update when it finishes. Deployments uploaded directly to a Git-connected site from your own CI have no source to rebuild from and update with the next deployment.
- If the site has password protection, the custom domain requires the password too.
- Once you remove a domain, it stops serving the site immediately; you can then delete the CNAME and TXT records from your DNS.

## Deploy under a subpath

To serve the docs under a subpath of your main site (e.g. `acme.com/docs`):

1. Set `basepath: /docs` in `docs.yml` (or write `acme.com/docs` in `instances[0].custom-domain`, and it's inferred automatically). Every page, asset, and `llms.txt` gets this prefix.
2. On your main site's reverse proxy, forward `/docs/*` to the docs site's default URL.

```nginx title="nginx: forward /docs to the hosted docs site"
location /docs/ {
  proxy_pass https://acme-payments-sites.butterix.com;
  proxy_set_header Host acme-payments-sites.butterix.com;
  proxy_ssl_server_name on;
}
```

## FAQ

<AccordionGroup>
  <Accordion title="What if I can't set a CNAME on the apex domain (acme.com)?">
    Most DNS specs don't allow a CNAME on the apex domain. Use a subdomain (such as `docs.acme.com`), or use your DNS provider's ALIAS / ANAME / CNAME flattening feature to point the apex at `sites.butterix.com`.
  </Accordion>
  <Accordion title="Verification keeps failing">
    Run `dig TXT _butterix.docs.acme.com +short` to check that the TXT record has propagated and that the value matches the console exactly (including the `butterix-verify=` prefix). Also make sure your DNS provider didn't append the root domain again, turning the name into `_butterix.docs.acme.com.acme.com`.
  </Accordion>
  <Accordion title="What do visitors see before the domain is verified?">
    Once the CNAME is live but before verification, opening the domain over `http://` shows a page explaining whether it still needs to be added to a site or only needs the TXT check. The certificate is issued after verification, so until then `https://` reports that a secure connection can't be established.
  </Accordion>
  <Accordion title="How long until HTTPS works? Do I need to upload a certificate?">
    No upload needed. Once the domain is verified, the platform issues a certificate through Let's Encrypt, usually within a minute or two, and renews it automatically 30 days before it expires. If the browser still reports an invalid certificate after a few minutes, check that the CNAME points at `sites.butterix.com` and that no CAA record on the domain blocks Let's Encrypt.
  </Accordion>
  <Accordion title="Can I put my own CDN or proxy in front of the domain?">
    Certificate issuance requires Let's Encrypt to reach ButterIX directly, so keep the domain's CNAME record in "DNS only" mode. If traffic must go through your own CDN, configure a certificate for the domain on the CDN and set the origin to `sites.butterix.com`.
  </Accordion>
  <Accordion title="Error: “This domain is already connected”">
    The domain is already connected to a site (possibly one in another organization). Remove it from that site first.
  </Accordion>
</AccordionGroup>
