Unfortunately all doesn’t always go quite so well; an issue that comes up often is where a subdomain always redirects to the primary domain when trying to view the subdomain with HTTPs. For example, when you go to http://subdomain.example.com then you view your pages as on your subdomain. When you go to https://subdomain.example.com however you see a page on your example.com website (most commonly the 404 not found error page).
From my experience, the most common cause for this problem with cPanel is that the subdomain directory name on the server is not identical to the subdomain name. For example, the directory name may be my-subdomain whereas your actual subdomain is mysubdomain (e.g. mysubdomain.example.com). For whatever reason the directory name must exactly match the subdomain name.
Fortunately the fix for this issue is simple. All we need do is create a symlink so that a link is created with the same name as the subdomain which then points to the directory into which your subdomain files are saved. If this doesn’t make much sense to you then contact your hosts technical support and ask them to create the symlink.