Haym

Active Member
May 12, 2017
39
5
8
UK
cPanel Access Level
Root Administrator
Hi,

I ran into an issue today where a customer's addon domain was being redirected to the relevant subdomain when performing a missing trailing slash redirection on a directory. For some reason "UseCanonicalName" was set to "On" for this particular vhost, while most on the server are set to "Off" (as I would expect). I created an include to fix this for the vhost in question.

Is there a reason cPanel configures some vhosts with UseCanonicalName set to On?

Code:
[root@server ~]# grep "UseCanonicalName Off" /etc/apache2/conf/httpd.conf | wc -l
774

[root@server ~]# grep "UseCanonicalName On" /etc/apache2/conf/httpd.conf | wc -l
28
Thanks
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
Hello @Haym,

We do have an internal case open (CPANEL-17936) to address an issue where UseCanonicalName is automatically set to "On" when subdomains are created through the SubDomain::addsubdomain cPanel API 2 function. I'll monitor this case and update this thread with more information as it becomes available. In the meantime, the following command can correct this in some cases:

Code:
/usr/local/cpanel/bin/userdata_update
Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
Hello,

To update, a resolution for CPANEL-17936 is planned for inclusion with cPanel version 72. It adds a UAPI call for adding a subdomain, with "UseCanonicalName" set to "Off" by default. Note that the behavior for the corresponding cPanel API 2 function will not change, as we avoid making changes to longstanding API behavior to ensure existing scripts using those API functions operate as expected.

Thank you.