It is possible to make virtual server alias, but keep a subdomain website functional?

SYSTEM INFORMATION
OS type and version Debian 12
Virtualmin version 7.30.8

I have a domain for a project that will be closed soon and I want www.domain.com to redirect to another domain. Stil, while domain.com should be closed, we have to keep subdomain.domain.com up and running for a while. Since I kind of messed up with alias domain I’dd thought would be better to ask for directions as my logic says this might not even be possible.

Thanks,

I’m not sure what you’re asking. Is it an alias? What is subdomain.domain.com? Is it a sub-server, an alias, or a top-level server in Virtualmin? A subdomain is just a name, so it could be anything. subdomain.domain.com does not have to be owned by an account named domain.com.

Which also maybe answers your question. If it’s a sub-server with its own content, you could promote it to a top-level domain.

But, if you need to redirect the other domain to a new one, why would you disable domain.com? You need a website that serves the redirect, right?

If it’s an alias, what is it an alias of?

i have mydomain.com and abcd.mydomain.com set as virtual server and sub-server respectively. I want to make mydomain.com alias of otherdomain.com, but stil have a working abcd.mydomain.com subserver. The reason is that after the end of the project, mydomain is no longer relevant, but still some of it’s traffic may be relevant for the otherdomain.com, while abcd.mydomain.com was actually a private use for the project members and accessible only via a VPN IP address, and needs to say until all activities were registered.

You have a couple of obvious options:

Keep it like it is, but add a redirect of mydomain.com to otherdomain.com. This is probably recommended, as having multiple websites with the same content is penalized by Google and other search engines (though you can tell it which one is authoritative by using something like rel="canonical" How to Specify a Canonical with rel="canonical" and Other Methods | Google Search Central  |  Documentation  |  Google for Developers).

Promote abcd.mydomain.com to a top-level server. Delete the current mydomain.com and add an Alias named mydomain.com to otherdomain.com. Again, I don’t think I’m recommending this, but it could be done.

Rename mydomain.com to something else. Add an Alias named mydomain.com to otherdomain.com. This leaves everything as it is, but disappears the mydomain.com top-level domain so you can make an Alias elsewhere.

For your case, I believe I recommend the first one: just add a redirect to mydomain.com pointing to otherdomain.com. You’re done. Nothing else needs to change. Keep in mind that if you expect traffic to continue to mydomain.com you want to exclude .well-known paths from your redirect, so that it can continue to get Let’s Encrypt certs renewed. Having an expired or invalid cert on the domain that redirects will also lead to a browser security warning.

Something like:

RedirectMatch 301 ^/((?!/.well-known).*)$ https://otherdomain.com/$1

301 is a permanent redirect, which is what you’d use when retiring a URL. Search engines will learn the new domain.

1 Like

Thanks. I think I’ll just put a landing page with links to relevant pages on the other domain.