Turn aliased domain into main domain

What’s the best way to “promote” an aliased domain and replace its master?

I.e., I have domain1 as the root domain, and domain2 as an alias. I want to get rid of domain1 and make domain2 the root domain, with no alias.

Maybe:

  1. rename the aliased domain to something random
  2. rename the root domain to domain2, update the directories, etc.
  3. delete the aliased domain

I would like to keep all the current (domain1) settings, but not the name.

SYSTEM INFORMATION
OS type and version Ubu 22.04
Webmin version 2.303
Virtualmin version 7.30.8 Pro
Webserver version Apache

There’s no direct way to promote an Alias, because it’s nothing but a ServerAlias in the Apache configuration, no data.

But, I guess it’s not unheard of for an alias to be used as part of a migration or something (but the ideal there would be to use the other name you know you’re removing as the alias and the domain it will end up as for the actual Virtual Server name).

So, yes, I guess you’re on the right track. Either delete or rename (if the alias has its own email) the alias, rename the top-level domain.

I’m not sure what you mean by “update directories”? You don’t need to change anything when renaming. Though, I guess if you really need the directories to match the name of the domain, you would need to do that, but you’ll need to be pretty careful to make sure all the homes in /etc/passwd get updated and whatever paths are in apps, etc. get updated, too. There’s a reason Virtualmin doesn’t change the home/username when renaming, and that’s because it’s potentially very messy.

Hi Joe, thanks.

I just mean selecting the “Change admininistration user name”, “Change home directory”, and “Change username prefix and group” buttons to “Automatically chosen…”. Yes, will have to pay attention to app paths; in my case I think there is maybe only one to reconfigure.

But I guess the database name isn’t going to change.

I think maybe it’s slightly messier as I think about it, and maybe the best thing would be to just delete the alias and create a new top-level domain, and migrate the old domain to there manually – db, app configuration, etc. There may not be that many tendrils to deal with, but perhaps better to start from scratch and catch everything at once.

1 Like

You can use the Virtualmin feature “Manage Virtual Server ⇾ Convert to Sub-Server” to convert an alias to a sub-server and later “Manage Virtual Server ⇾ Move Virtual Server” feature to convert the sub-server to a top-level virtual server:

3 Likes

Thanks Ilia, will give that a run!

Oh, I didn’t even think of that path.

Oh, but, wait. That’s going to be its own content, not the parent that OP wants to rename to the Alias. So, that isn’t a solution.

I’m not sure I understand what that means, since I thought the OP wanted to “promote” the alias to a top-level domain.

Yet, re-reading the questions and thinking more about it, if the goal is to make alias1.domain.tld into domain.tld while keeping all the settings and content of domain.tld, then the easiest way is to delete the alias and rename the origin domain to the name alias used.

FWIW, I just deleted the subdomain and created a new, top-level name with the same name. Then migrated the few apps from the old domain, and then deleted that. Pretty simple, as there weren’t many apps to update, and the changes were simple (db name, a few paths).

All good, thanks for going through the options!