Mail Subdomain added as alias to main domain in httpd.conf

nslave

Member
Feb 27, 2017
5
0
1
Bulgaria
cPanel Access Level
Reseller Owner
Hi,
I have a issue that I cannot seem to understand how to resolve. There are multiple domains hosted on the server and some of them experience this strange behavior. From time to time (I think it is when the httpd rebuild itself) some subdomains on some domains start to load the main domain. When I open, lets say mail.example.com, the page that it is loaded is example.com. When I look at the httpd.conf I see that mail.example.com is listed as an alias for example.com. When I remove it the issue is resolved but I am interested in how to resolve it permanently, because every time the httpd is rebuilt the issue arises again. Every domain is a separate account if it matters.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,200
363
Hello,

This behavior is by-design as of cPanel version 60:

Change in mail. alias behavior for Apache server
The system now automatically creates an Apache server alias for the mail. subdomain for each domain, parked domain, and addon domain (but not subdomains). This allows the mail alias to appear in the same virtual host as the parent domain. We made this change in order to simplify Mail SNI and SSL certificate management and reduce unnecessary mail client warnings.

For example, Apache will now respond to mail.example.com as an alias for example.com. However, Apache will not automatically respond to mail.subdomain.example.com as an alias for the subdomain.example.com subdomains.
Thank you.
 

megahost

Member
PartnerNOC
Jun 10, 2012
11
0
51
cPanel Access Level
Root Administrator
Hi,

i get the same problem, mail.mydomain.com is showing the contect of mydomain.com and my SEO guy asked me to fix that.
Is there any way to fix that?

thanks.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,200
363
i get the same problem, mail.mydomain.com is showing the contect of mydomain.com and my SEO guy asked me to fix that.
Hello,

You can manual remove the "mail" entry from the "serveralias" line in the following configuration files under the /var/cpanel/userdata/$username directory:

/var/cpanel/userdata/$username/$domain.com
/var/cpanel/userdata/$username/$domain.com_SSL


Then, remove the .cache files for these domain names:

/var/cpanel/userdata/$username/$domain.com.cache
/var/cpanel/userdata/$username/$domain.com_SSL.cache


Next, rebuild the Apache configuration file:

Code:
/scripts/rebuildhttpdconf
However, keep in mind this is part of what allows SSL certificate validation for mail.domain.tld as part of the Domain TLS functionality:

What is Domain TLS - cPanel Knowledge Base - cPanel Documentation

Thank you.
 

4u123

Well-Known Member
PartnerNOC
Jan 2, 2006
929
21
168
This is causing a problem with the mail subdomain showing up in search engine results, even though the mail subdomain has never been linked to from anywhere.

I'm sorry guys, but a subdomain that is not used for web content has no right being included in the Apache configuration, especially when it is a CNAME. This can cause all sorts of problems with SEO.

We need an option to disable this in tweak settings please. ASAP

You said...

We made this change in order to simplify Mail SNI and SSL certificate management and reduce unnecessary mail client warnings.

There are no "unnecessary" mail client warnings. Those warnings are legitimate This functionality is outdated anyway. Why use the mail subdomain at all when the main domain is already configured and will most likely be covered by an SSL cert anyway?

Moving forward, you should be looking at dropping the mail and FTP subdomains completely, rather than trying to find a workaround that is impractical and could cause damage.

This is completely unwanted and unnecessary.
 
  • Like
Reactions: MaxFein

TAugustine

Registered
May 26, 2020
1
0
1
Noida, India
cPanel Access Level
Website Owner
Hello Support,

I am also facing the similar issue, mail.mydomain.com is showing the exact same contents of mydomain.com

This is a big-time issue as google search console is flagging all the pages as duplicate content 'Duplicate without user-selected canonical'

Kindly advice as a website owner how can I fix this? Should the workaround provided by you to be done by the hosting provider?

Thanks in Advance.
 

Attachments

4u123

Well-Known Member
PartnerNOC
Jan 2, 2006
929
21
168
This has come up again with a customer today - they are really not happy about it. I honestly don't know what you guys were thinking with this.

At the very least you need to globally change the DNS records for the mail subdomain to an A record instead of a CNAME so it can have its own separate vhost entry and point it to some default page instead! It has to be done.

Come on guys pull your socks up! It's painful to see this kind of thing happening.