Mail.mydomain.com is showing my website and then getting indexed

SYSTEM INFORMATION
OS type and version Ubuntu Linux 22.04.5
Usermin version 2.102
Virtualmin version 7.20.2 Pro
Theme version 21.20.7
Apache version 2.4.52
Package updates 10 package updates are available

the issue

I found on Google my https://mail.quantumwarp.com/ had been indexed showing stuff from https://quantumwarp.com/ So I went to https://mail.quantumwarp.com/ and sure enough I could see my main site.

I also check on a cpanel sserver and I visited the mail.domain.com and it redirected me to the normal www.mydomain.com

question

This is obviously causing issues with google indexing and I do not want this.

Is this normal?

solution

  • You could manually add htaccess redirects
  • Virtualmin could be made to not add an alias of mail.domain.com (or your mail server) into the apache virtualhost?

Any thoughts, is this a bug/feature request?

so only an issue with Apache webservers?

Or is this a basic issue withe the way the google bot trawls the web (ie it is not being banned/blocked when perhaps it should.
Does this happen with other (possibly) more friendly search engines?

It will happen with all of the search engines because mail is added as an aliases, perhaps because of how the keys encrypted certificate is grabbed.

I’ve not seen this reported
and just tested a live domain that is well reported as domain.com (I admit I detest Google’s bots so use another well known search engine DuckDuck) but the mail.domain.com is not indexed. Of course it is an Nginx site and I am pretty certain that there is no mailto link provided on the website as bait

Yes, I confirm that mail.domain.tld does show the same content as domain.tld and www.domain.tld; also it will get indexed by Google and the ranking will be affected due to duplicate content unless the canonical tag is specified in the HTML.

See:

This appears to be the only available workaround for websites hosted on Virtualmin with Apache. Virtualmin with Nginx, I don’t know.

Google read the alt names from the certificate

Also Google monitors your browser use and adds unknown domains within hours to their index… I double checked this.

this still has its drawbacks as both domains will be in the index. It will solvedsome of the issue. Thanks.

I might do a feature request if I can thing of what to ask to fix this. Maybe a 403 when the cert id not being requested.

mail.domain.tld could show any content, even the standard Virtualmin under construction page. Anything BUT the content that is being displayed at domain.tld and www.domain.tld

maye a mandatory htaccess redirect to the root domain ie mail.domain.com 301 → domain/com excpet if it is a /well-know/ folder thing for lets encypt.

Well, that should be fine. There have been so many requests (and blotched attempts) to have webmail on mail.domain.tld. Why should we not offer that?

In addition to webmail the way it is, I mean.

Yeah, this is a bug-like. mail should redirect to the actual domain automatically. mail exists for the purpose of being able to get a Let’s Encrypt certificate for it, but it shouldn’t be serving up web pages.

This is already possible. Everything in Virtualmin is configurable. But, if you want a Let’s Encrypt cert for mail.domain.tld, it needs to be able to serve files from .well-known on that domain, so an alias has to exist.

@Jamie and @Ilia should the mail alias get a redirect to www or domain.tld maybe? (Obviously excluding .well-known)

1 Like

Yeah we could certainly add a redirect - currently mail.domain.com is just treated like domain.com and www.domain.com in the apache config.

I agree, we should redirect it to the main domain, not www though. But what about the other aliases? There are quite a few, like mail, autoconfig, and autodiscover and perhaps other.

This is an example of an issue that is conceptually very simple but quite difficult to implement cleanly. ):–(

1 Like

Agree it is complicated.

Can you add a location command on the Apache config for each domain for everything except the well know folder?

I don’t know what nginx comparison is.

Overtime these domains would become unindexed and new one should not be.

Hey,

Personally, since I don’t use “mail.domain.com” for referencing mail or anything else within my install, one of the first things I do after a fresh VM install is go into the Server Templates and remove the alias for “mail” from the configuration block of Apache.

Not personally fan of extra pre-configured aliases besides “www” since I like having control over how aliases are used. I disable “admin” and “webmail” option too for the same reason.

I get the point in why this was setup as @Joe explains, and agree with the thread on perhaps making this a redirect to “www” or the “naked domain”.

1 Like

A redirect should be as follows:

Mail.domain.com → domain.com

Mail.subdomain.domain.com → subdomain.domain.com

@shoulders,

That could be done via a “.htaccess” file at the root of your website if using Apache.

When I write code, I often setup a sub-domain “sandbox.domain.com”, then in my code I do conditional redirects to either “https://domain.com” or “https://sandbox.domain.com”. To do this, you detect the “host” requested, then conduct the redirect accordingly.

Ofcourse, this could be added within the VirtualHost configuration as well, though even as a short term solution redirecting “mail.domain.com” to “domain.com” could be handled by a “.htaccess” file.

You would add the logic to the “.htaccess” file of “domain.com”.

*** We also use the above method to redirect “www.domain.com” to “domain.com” for SEO optimization as “www” is also an alias just like “mail” is by default ***

I’ll look into adding an option to setup these redirects by default for new domains

1 Like

What about existing domains? Should these get fixed when a new SSL cert is issued or maybe when the DNS zone is reset?

@Jamie,

In theory, if you implement the redirects in an upcoming release, wouldn’t it be as easy as “disable” then “enable” the “Apache” feature for the changes to take effect?

*** to address @shoulders last remark ***