The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Alias for add on domain

Discussion in 'General Discussion' started by yoachan, Apr 15, 2011.

  1. yoachan

    yoachan Well-Known Member

    Joined:
    Jan 10, 2010
    Messages:
    65
    Likes Received:
    0
    Trophy Points:
    6
    Dear all,

    We have a cpanel account with a main domain, let's just say "primary.com".
    within that account we had an add on domain "secondary.com".

    recently we bought another domain name "secondary.net" and we wanted to use it as a name alias for secondary.com so that our users can visit our site either using secondary.com or secondary.net.

    If we doesn't use cpanel/whm, I'll simply add a "ServerAlias" tag in httpd.conf for secondary.net. But because we use cpanel/whm, this config will be erased by cpanel when cpanel update apache's config.

    My question is how to add this "serveralias" for my addon domain? AFAIK a parked domain only works for main domain, and not for addon domains. CMIIW.

    any help appreciated.

    Regards,

    Yoachan
     
  2. JayFromEpic

    JayFromEpic Well-Known Member

    Joined:
    Apr 2, 2011
    Messages:
    204
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Scottsdale, AZ
    cPanel Access Level:
    Root Administrator
    I am not 100% positive but I am think you can do this when you set it up as a redirect to that domain. There will be a box that you can check that says make alias. If you choose that, it will allow you to do what you are trying to do.
     
  3. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    You could do the following to get this working:

    1. Add the new domain as an addon domain
    2. Pick a different subdomain name for it over the original domain's subdomain, since all addon domains map to a subdomain and must map to a unique subdomain name
    3. Use the same path as the original addon domain in the "Document Root:" field (this would allow it to point to the exact same content as the other domain but show the new domain name in a browser when visiting that domain, which is basically what a parked domains does)
     
  4. yoachan

    yoachan Well-Known Member

    Joined:
    Jan 10, 2010
    Messages:
    65
    Likes Received:
    0
    Trophy Points:
    6
    @Josh & cPanelTristan: Thanks for your reply
    @cPanelTristan: I think that will work, but if I use another add on domain, then I will have two webalizer and awstats reports...
    Can I have those two addon domain to share same awstats and webalizer report?

    regards,

    Yoachan
     
  5. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    If you really want them to share the same stats, you'll simply have to add the domain the way I've indicated, then manually edit the /var/cpanel/userdata/username/secondary.main.com file and move the anothersecondary.main.com file where username is the cPanel username, where secondary.main.com is the subdomain name for the secondary.com domain, and where anothersecondary.main.com is the subdomain name for the secondary.net domain.

    The files that build httpd.conf are in /var/cpanel/userdata/username/ location. To create a parked domain in secondary.main.com file, you'd simply edit the serveralias: line to add the addon domain and addon subdomain names:

    Code:
    serveralias: anothersecondary.main.com secondary.net www.secondary.net
    At that point, you'd then have to move the subdomain you'd created for the secondary.net domain:

    Code:
    cd /var/cpanel/userdata/username
    mv anothersecondary.main.com anothersecondary.main.com.bak
    Then you would want to make a backup of Apache configuration, rebuild Apache configuration and restart Apache for the changes to take effect:

    Code:
    cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak110418
    /scripts/rebuildhttpdconf
    /etc/init.d/httpd restart
    This will then revise the entry for secondary.net to be within the secondary.com VirtualHost section instead.

    Please note that you must perform the steps I mentioned initially to create the addon domain in order for the DNS and other entries to exist that are required for the cPanel files. You cannot simply edit the userdata files to add the domain for this to work. The domain needs that cPanel creation before manually editing these files to get it working in the manner you'd need.
     
  6. yoachan

    yoachan Well-Known Member

    Joined:
    Jan 10, 2010
    Messages:
    65
    Likes Received:
    0
    Trophy Points:
    6
    @cPanelTristan

    Thanks for your reply. I'll give it a shot.

    regards,

    yoachan
     
  7. xmlhosting

    xmlhosting Registered

    Joined:
    Oct 2, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator

    This is not working for me. I have a client with a few addon domains. He would like domain1 to point to domain2 as an alias. Thus that wehn you type in domain2 in the browser it will display the site of domain1 but domain 2 will remain in the browser. What is happening after doing what you described is that the domain redirects to domain1. Thus when I type domain2 in it turns into domain1 in the browser.
     
  8. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    You don't have any redirects set in .htaccess either on /home/username/public_html or /home/username/public_html/subdomain folder, right? If you do, could you try moving the .htaccess file out of the way and check both domains in a proxy to ensure you aren't cached? You can use proxify.net or kproxy.com as a proxy to check it.

    Otherwise, you might try the following thread information that I posted after the first post you referenced:

    http://forums.cpanel.net/f5/alias-add-domain-203721.html#post839211
     
Loading...

Share This Page