# www and apex domains

Source: https://modulify.ai/docs/publish/www-and-apex

Attach the www hostname alongside your root domain and pick one canonical address.

`example.com` and `www.example.com` are two different hostnames, and each needs its own certificate and its own DNS records. Modulify handles both, and it is up to you which one visitors end up on.

## Before you begin

You need a custom domain already connected, on a paid plan, with the Manage domains permission. The www variant is only offered for a root domain of exactly two labels. A subdomain such as `blog.example.com` and a multi part root such as `example.co.uk` get no www row at all.

## Modulify adds the companion for you

When you connect `example.com`, Modulify requests a certificate for `www.example.com` in the same operation and records its DNS requirements too. The success message says so: "example.com and www.example.com are both waiting on DNS. Add the required records at your DNS host to finish connecting them."

Submitting the domain with a `www.` prefix makes no difference. Modulify normalises it to the root and treats the www form as the companion, so the root is always the main slot.

## The WWW variant row

The Domain tab shows the companion under its own heading. It has its own status badge, its own **Remove** button and, while it is unconnected, its own table of four DNS records.

The heading reads **WWW variant** when the companion is the www hostname. If your main slot is already the www hostname, the heading reads **Root domain** instead and the button reads **Add root**.

When the companion is not attached, the row describes it as "Add `www.example.com` so visitors reach your site either way" and offers an **Add www** button. When it is attached, the description reads "Your site answers also as www variant."

## Add the records

The www records are the same four types as the root, at names prefixed with `www`. Add them at the same DNS host, alongside the root ones. See [DNS records](/docs/publish/dns-records) for the full table.

It is completely normal for the root to read Connected while the www variant reads Pending. Most people point only the apex and never add the www records, and nothing breaks. The site simply does not answer on the www hostname.

## Both hostnames serve the site

This is the part that surprises people. The WWW variant is not a redirect. When both are connected, both serve the same pages from the same deployment and the same certificate, so your site genuinely answers at two addresses and search engines see the same content twice.

## Pick one canonical address

Once both are connected, an **Ask AI** hint appears on the WWW variant row: "Want one address instead of two? Ask the AI to redirect the www variant to your root domain, or the other way round. It checks what is connected first, and the change goes live on your next publish."

Click **Ask AI** and chat opens with the request already written, naming both hostnames and the direction. Say which way round you want it if the default is not what you meant.

The redirect is a host based rule added to your project's build configuration, keeping the path and query string intact. Because it is compiled during the build, it goes live on your next publish, not the moment the AI finishes editing.

The AI checks what is actually connected before writing anything. If only one hostname is connected, it refuses and tells you to connect the other one first, because redirecting to an address that does not resolve takes the site offline.

## Removing one of them

Both rows have their own **Remove** button, and both ask before doing anything.

Removing the www variant asks "Remove www.example.com?" and explains that your site will stop working at that hostname while the root stays connected. The confirm button reads **Remove variant**.

Removing the root asks "Remove example.com?" with the same shape, and the confirm button reads **Remove domain**. If a www variant is attached, removing the root promotes the www hostname into the main slot rather than dropping both, and the message afterwards reads "example.com was removed. www.example.com is still connected, remove it separately if you want that one gone too."

Removing a domain needs the Manage domains permission. A site holds one custom domain slot at a time, and the tab says so: "Only one custom domain can be connected at a time. Remove it to connect a different one."

## Next

- [DNS records](/docs/publish/dns-records) lists what each record does.
- [Troubleshoot a domain](/docs/publish/troubleshooting-a-domain) covers a hostname stuck on Pending.
- [Your free web address](/docs/publish/your-web-address) is the third hostname your site answers on.