Community Forums
Connect with us on LinkedIn
Community Notice
Closed Thread
Results 1 to 1 of 1
  1. #1
    rmj
    rmj is offline
    Member
    Join Date
    Feb 2003
    Posts
    17

    Default addon domains, swap servername/serveralias

    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.
    Last edited by rmj; 03-01-2003 at 03:55 PM.

Similar Threads & Tags
Similar threads

  1. ServerName and ServerAlias values reversed in httpd.conf when adding new account
    By mwmconsulting in forum cPanel and WHM Discussions
    Replies: 8
    Last Post: 08-12-2010, 10:35 AM
  2. ServerAlias and ServerName are Backwards in httpd.conf
    By zelf in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 06-15-2009, 01:21 AM
  3. ServerAlias has lost www on all domains after upgrade
    By anton_latvia in forum cPanel and WHM Discussions
    Replies: 37
    Last Post: 02-19-2008, 08:55 AM
  4. ServerName and ServerAlias swapped over in httpd.conf :(
    By girishn in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 09-07-2007, 08:11 AM
  5. Addon Domain Problem - Serveralias not added to httpd.conf
    By mydomain in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 11-23-2004, 06:57 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube