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.

addon domains, swap servername/serveralias

Discussion in 'General Discussion' started by rmj, Mar 1, 2003.

Thread Status:
Not open for further replies.
  1. rmj

    rmj Member

    Joined:
    Feb 20, 2003
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    I have recieved complaints from people using the addon domain function that when they go to addondomain.com/folder in the browser bar it comes up subdomain.maindomain.com/folder

    and the way i see it is becaused addon domains are essentially parked domains on top of subdomains. I have found a simple solution to this, but am wondering of any other impacts it may have on other cpanel stuff, if nobody sees any, which i dont think there any, i think we should suggest this to the cpanel guys, below is the example:

    <VirtualHost XXX.XXX.XXX.XXX>
    BytesLog domlogs/subdomain.maindomain.com-bytes_log
    User username
    Group grpname
    ServerName subdomain.maindomain.com
    ServerAlias addondomain.com *.addondomain.com
    ServerAdmin wwwadmin@maindomain.com
    DocumentRoot /home/username/public_html/subdomain
    CustomLog domlogs/subdomain.maindomain.com combined
    ScriptAlias /cgi-bin/ /home/username/public_html/subdomain/cgi-bin/
    User username
    Group grpname
    </VirtualHost>

    Ok above we have what cpanel would write to the httpd.conf if were to add an addon domain to maindomain, i believe its fairly self explanatory to anyone familair with apache, the problem lies where ServerName and ServerAlias are, apache will always want to use the ServerName, but will also load the aliases, so this works, but if html does no specify the aliases directly, it will go to the servername, and since our ServerName is the subdomain.maindomain.com it displays an ugly url to the customer.

    What I have done is switched it up like this:

    <VirtualHost XXX.XXX.XXX.XXX>
    BytesLog domlogs/subdomain.maindomain.com-bytes_log
    User username
    Group grpname
    ServerName addondomain.com
    ServerAlias subdomain.maindomain.com *.addondomain.com
    ServerAdmin wwwadmin@maindomain.com
    DocumentRoot /home/username/public_html/subdomain
    CustomLog domlogs/subdomain.maindomain.com combined
    ScriptAlias /cgi-bin/ /home/username/public_html/subdomain/cgi-bin/
    User username
    Group grpname
    </VirtualHost>

    Here we have swapped the ServerName with the actual addondomain.com and tossed down in the ServerAlias the subdomain where it actually resides(probably not even necessary) the *.addondomain.com is necessary for it to respond to the www. call

    This solves the issue so when user goes to addondomain.com/folder/folder/etc... in IE it displays what the user wants to see, exactly that, not subdomain.domain.com/folder/folder/etc

    ---

    In conclusion this is a bit involved, I hope everyone understood where and what I am talking about, I just want some opinions on whether this would Impact anything else in the accounting, bandwidth calculation or anything (I truly dont believe so)

    If this is a good solution, PLEASE cPanel change the way addon domains are written to httpd.conf to this way, simple and VERY efficient change.
     
    #1 rmj, Mar 1, 2003
    Last edited: Mar 1, 2003
Loading...
Thread Status:
Not open for further replies.

Share This Page