There are many variations of this problem. We can’t guess which one you have, but it’s always a misconfiguration in Virtualmin. It’s configuring the wrong IP or a mix of IPs and the way Apache decides which site to serve doesn’t match what you think it ought to do.
Since you’re using Cloudflare, that’s probably the source of the trouble. Are you using the tunnel feature? Or are you proxying to the public IP of your server? (Search the forum, the tunneling problem was just discussed.)
It can also be caused by a problem with IPv6 configuration.
In Virtualmin, we have top level virtual servers and sub servers.
A top level virtual server can be:
domain.tld
sub.domain.tld
A sub server can be:
domain.tld
sub.domain.tld
As Joe explained (yet again) recently, top level virtual servers and sub servers are about ownership. A user X is the owner of a top level virtual server for doman abc.tld. Now if you wish the same user X to also be the owner of def.tld, then you should create a sub server in Virtualmin.
However if you are okay with user X being owner of abc.tld and user Y being owner of def.tld then you should create only top level virtual servers.
The creation of top level virtual servers is the norm in Virtualmin and sub servers are intended to be used only in specific cases related to ownership. Also, a top level virtual server can host doman abc.tld and / or subdomain sub.abc.tld.
In this context @vineethachari, tell us what you mean by subdomain, main folder and intended folder.
In Virtualmin, for a top level virtual server for domain abc.tld, the main folder (or directory) will always be /home/abc/public_html