# WordPress Multisite with subdomains
Source: https://docs.webgee.com/en/hosting/wordpress/wordpress-multisite-subdomains











A WordPress Multisite network using subdomains needs each subdomain created in
the control panel and pointed at the **network's** document root, not at a
directory of its own. Applies to shared and reseller hosting on cPanel and
DirectAdmin.

Multisite serves every site from one WordPress installation and decides which
site to show from the hostname in the request. If a subdomain has its own
document root, the request never reaches WordPress and you get an empty
directory or a 404.

## cPanel [#cpanel]

Go to **Domains** → **Create a new domain**.

Enter the subdomain and set the document root to the same directory as the
Multisite installation.

<img alt="Creating a subdomain in cPanel with a shared document root" src="__img0" />

That is normally `public_html`. If the network runs on an addon domain, use that
domain's directory instead.

<Callout type="warn">
  cPanel proposes a new subdirectory as the document root by default, such as
  `public_html/shop`. Accepting it is what breaks Multisite. Overwrite it with
  the network's own document root.
</Callout>

### Correcting an existing subdomain [#correcting-an-existing-subdomain]

If the subdomain already exists with the wrong root, select **Manage** beside it
on the **Domains** screen.

<img alt="The Manage option beside an existing subdomain" src="__img1" />

Set the new document root and select **Update**.

<img alt="Setting a new document root" src="__img2" />

## DirectAdmin [#directadmin]

Go to **Subdomain Management** → **Add Subdomain** at user level.

DirectAdmin always creates its own document root, at
`/domains/yourdomain/public_html/subdomain`, so this must be corrected after
creation rather than during it.

1. Select the pencil icon beside **Docroot** for the new subdomain.
2. Set **public\_html** and **private\_html** to custom, both pointing at the
   Multisite installation's document root.
3. Save.

<img alt="Setting a custom document root in DirectAdmin" src="__img3" />

Allow a few minutes for DirectAdmin to rebuild its configuration before testing.

## Consider a wildcard instead [#consider-a-wildcard-instead]

Adding a subdomain by hand for every site does not scale, and it is easy to
forget when a network lets users create their own sites.

A wildcard subdomain — `*.yourdomain.com` pointed at the network's document root
— covers every site, present and future, with one entry. Set it up the same way,
using `*` as the subdomain name. You will also need a wildcard DNS record and,
for HTTPS, a wildcard certificate.

## Verify [#verify]

* The subdomain loads its Multisite site rather than a directory listing or
  404\.
* It appears correctly under **My Sites** → **Network Admin** → **Sites**.
* HTTPS works. A standard certificate does not cover subdomains; check the
  padlock on a subdomain, not just the main domain.

## Related [#related]

* [Fix "Unable to create directory"](/en/hosting/wordpress/resolving-the-unable-to-create-directory-error-in-wordpress)
