Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have example.com which is the domain that hosts other domains.

On cPanel normally you can get to the actual cPanel by visiting cpanel.hosteddomainA.com, hosteddomainA.com/cpanel or hosteddomainA.com:2082

What I would like to accomplish is to have the hosteddomains cPanel auto redirect to something like my.example.com:2082 . Doing this would allow me to adequately throw an SSL cert in my. and really offer a secure experience to my users.

I know it's possible because bluehost does the same. They redirect to my.bluehost.com.

Can anyone think of how to do it?

share|improve this question

migrated from stackoverflow.com Sep 27 '12 at 1:25

This question came from our site for professional and enthusiast programmers.

You could try putting something like this in the htaccess file of your main domain's document root or in the vhost config:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^my\. [NC]
RewriteCond %{HTTP_HOST} ^cpanel\. [NC,OR]
RewriteCond %{REQUEST_URI} ^/cpanel
RewriteRule ^ http://my.masterdomain.com:2082/ [L,R=301]
share|improve this answer
That would redirect cpanel.domain.com and domain.com/cpanel but is there also a way to redirect domain.com:2082? I like where you're headed though.. I will add that in as a start. – Peter Sep 27 '12 at 4:55

You can create a CNAME DNS record with the subdomain my.example.com pointing to example.com. This way, the user will be able to access any of the resources available on example.com (such as example.com/cpanel) but will be a part of the my.example.com subdomain.

A CNAME DNS record, btw, creates an "alias" to another subdomain or domain. It is NOT a good idea to create a CNAME record for the root/apex domain, e.g. a CNAME record from example.com pointing to www.example.com.

share|improve this answer
Does the person who downvoted this care to explain why this is not a valid or technically-correct answer? – L0j1k Sep 26 '12 at 18:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.