Sharing one website's files across multiple domains
Make a new domain or subdomain show exactly the same site as one you already have, without keeping two copies of the files.
If you want a second domain name, or a subdomain, to show exactly the same website as one you already have, you don't need to upload your files a second time or keep two copies in sync. When you add the new domain, you can point it at an existing domain's files instead of giving it an empty folder of its own.
This is useful for things like a short "typo" domain that should show the same site as your main one, a .net you bought alongside your .com, or a subdomain that's meant to be a mirror of your main site rather than a separate section of it.
Steps
- Click Domains & SSL in the sidebar.
- Find the Add domain card.
- Type the new domain name (or subdomain) into the Domain name field, exactly as normal.
- In the Document root choice, select Share the files of… and pick the existing domain whose files you want it to show, instead of leaving it on "Its own - a new empty folder for this domain".
- Click Add domain.
The new name is reachable right away, it just shows the same files, from one place, as the domain you chose.
What's shared, and what isn't
Only the website files are shared. Each name still gets:
- Its own DNS zone.
- Its own SSL certificate (request one for it separately, see the article on getting a free certificate).
- Its own mailboxes, if you want them. Email belongs to the domain name, not to the files it happens to show.
A shared domain also runs on the same PHP version as the domain it shares, since one folder of files can't be served by two different versions of PHP at once. Changing the PHP version on either name changes it for both.
Where this shows up in your domain list
A shared domain is marked shared in your domain list, with the name of the domain it's sharing from shown underneath it, so it's always clear which name actually holds the files.
Removing a shared name later
Removing a domain that shares another domain's files only removes that name, its DNS zone (unless you untick that) and its own mailboxes, if it had any. The original domain and its files are completely unaffected, there's nothing to lose on that side.