Best way to add alias to existing webspace

SYSTEM INFORMATION
OS type and version Ubuntu Linux 20.04.6
Usermin version 2.203
Virtualmin version 7.30.8
Theme version 23.03
Nginx version 1.18.0

I have an automation, that create SubServers under a main-domain:

MyMainDomain.com
tr12uviae213c.mymaindomain.com
vlqcguiaderna.mymaindoamian.com
and so on...

If customer decide to switch from a pre-account to a live-account, he need to add a domainname: e.g. customerDomain.com

What is the best way to archive this - even from SEO perspective (duplicate content, etc.)?

Should I:

  1. Edit the host-file and fully replace the domain-name?
  2. Edit the host-file and add an Alias with the customerDomain?
  3. any other way (please describe how)

terminology easily gets confusing … in the Virtualmin world, subserver is just an administrative term where one admin account can see and manage many totally different and unrelated URLs (aka domains) in that single Virtualmin account.

SubDomains are a DNS and URL kind of thing – meaning a dot is added and a prefix (subdomain) is added to a lower/shorter domain. in my view, your “domain” is mymaindomain.com … and your subdomain name is trl2uviae213c – put together of course the full URL aka subdomain is trl2uviae213c.mymaindomain.com.

in Virtualmin you most likely have mymaindomain.com as your main/primary domain in that single admin account. Then in that admin account, you can create, for administrative and ownership functions, a subserver. a subserver can be ANY URL or domain or subdomain – it is not required to be related to the primary domain in any way !!

of course you are allowed to create a subserver named trl2uviae213c.mymaindomain.com if you want to, as well as making a subserver named example.com and another subserver named abc123.com.

I hope this helps some with the terminology :smile:

Sadly I don’t have any experience with your actual issue of SEO and launching a production URL from a test/devel URL … hopefully others can help with that, but I am guessing there is a way to do it via the Virtualmin control panel without needing to edit any config files by hand.

I echo what @verne says about editing config files by hand on a Virtualmin server and if you are using this idea for a SaaS related service then please be aware of one very big gotcha:

If a sub server of Virtualmin is compromised, the hacker gains access to all other sub servers which have been created under that virtual server.

Instead of automation to create sub servers and editing config files by hand, you should use Virtualmin’s top level virtual servers and rename the domain from say
tr12uviae213c.mymaindomain.tld
To
Somedomain.tld as and when you need to switch from a pre-account to a live account.

This will make the rest of your virtual servers more isolated in case one of them is compromised and will save you troubles with automatic renewal of SSL certificates when the owner of somedomain.tld moves away without informing you about it first.