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.

Subdomains always redirecting to www.subdomain.domain.com

Discussion in 'General Discussion' started by mofolo, Jan 26, 2012.

  1. mofolo

    mofolo Member

    Joined:
    Jan 26, 2012
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hello,

    I have this current set up with my website:

    www.domain.com
    subdomain.domain.com

    However, when I create subdomain.domain.com it will always redirect to www.subdomain.domain.com

    I have found a way to temporarily fix this. First; I remove the DNS A entry which has www.subdomain.
    Next, I go into the http.conf and change ServerAlias from www.subdomain.domain.com to subdomain.domain.com
    and also set UseCanonicalName to Off

    However, every time I rebuild the httpd.conf file either by changing the settings or easyApache, the problem re-occurs.
    The ServerAlias changes back to www.subdomain.domain.com.
    (I have edited /var/cpanel/userdata/username/subdomain, but the problem still happens)

    Is there a permanent fix that makes Cpanel not redirect to www.subdomain?
     
  2. 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
    cPanel would not automatically redirect to the subdomain www version unless there is an entry in the main domain or subdomain .htaccess file for non-www to www redirection. Please check /home/username/public_html/.htaccess for any redirects on the account.

    As for the /var/cpanel/userdata/username/subdomain.domain.com entries, if you are revising those, I've never heard of those files re-adding the www subdomain as a serveralias at that point or rechanging the canonical setting. They should stick if you revise the entries in that file and then run "/scripts/rebuildhttpdconf" afterward to check /usr/local/apache/conf/httpd.conf settings.
     
  3. mofolo

    mofolo Member

    Joined:
    Jan 26, 2012
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hi Tristan,

    Thanks for the reply.

    You were very right - it was being redirected by the .htaccess. It has been fixed now, Thanks!
     
Loading...

Share This Page