Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have masterdomain.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.masterdomain.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.

2 Answers 2

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

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

Your Answer

 
discard

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.