CNAME and Multiple Domains

OS type and version: CentOS Linux 7.9.2009
Webmin version: 1.981
Virtualmin version: 1.830

I am going to do my best to describe what I am trying to accomplish and I apologize if this is not clear.

I am trying to setup a way to have multiple domains using CNAME records (clients are using Cloudflare for managing DNS records) to point to the same content (it will dynamically change based on the domain) without it redirecting to primary domain.

Main Domain:
Primary Content Domain:
Subdomains:,, etc…

Issue: I have tried setting up alias to the primary server and that results in serving the main domain’s content without redirection. This isn’t how I want it to serve, I want it to serve the content of the primary content domain without redirection.

Any suggestions on what I should do?

If they’re using Cloudflare, the easiest way I can think of to do it is with Page Rules. You log in to your account, go to the page rules tab. Then you make a rule where:

then there’s a dropdown tab to select what happens to that url. Scroll down to Forwarding URL and then enter the URL where you want it to go.

I’m sure somebody will come along with a far more eloquent way of doing it, but in Cloudflare that’s the easiest that I know of.

I am still having difficulties.

I have seen this done before so I know it’s possible. But I just can’t seem to get our server to respond appropriately. We really want to make this happen. We do not want the client domain to be redirected. We just want the content to be served regardless of what domain. I am controlling how the content is display using our own PHP script. The issue that we seem to be having is if you go to it for whatever reason either redirects to (NOT the experience we want) OR it actually serves the page without redirection. I am finding that SOME users are able to access the page without a redirection while others are being redirected (NOT the experience we want). I have verified that the DNS records are setup correctly using CNAME records. Any suggestions on how to fix this within the server?

Update: I notice that it works perfectly fine when you include https:// but if you only use http:// then it fails to work.

I would like to get some insights from The Virtualmin team also in how to set this up correctly.

Thank you again for any responses.

No, it doesn’t.

I get this using Chrome:

Well that is frustrating, I have tried it several computers and networks this morning and it was working. :expressionless:

I tried it on Edge and got a blank page but when I hit the refresh button I got the same screen. Same with Firefox.

Did you try create alias domains in Virtualmin for this? Just select the main domain on the left menu, go to Create Virtual Server → Alias of and enter as the domain name.

1 Like