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.

Advice on best way to redirect old domain and subdomains in WHM

Discussion in 'General Discussion' started by RedactUK, Sep 6, 2012.

  1. RedactUK

    RedactUK Member

    Joined:
    Apr 22, 2004
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    On my server I have one account with with one domain:

    newdomain.com

    with 3 subdomains:

    sub1.newdomain.com
    sub2.newdomain.com
    sub3.newdomain.com

    I also had a second account on same server and IP address:

    olddomain.com

    also with 3 subdomains (named same as on newdomain), so:

    sub1.olddomain.com
    sub2.olddomain.com
    sub3.olddomain.com

    Recently I deleted the account for olddomain and parked olddomain.com on newdomain.com. Now while I'm able to 301 redirect any hits to olddomain.com to newdomain.com I can't work out how to do the same with the subdomains. I'm presuming you can't have subdomains on a parked domain, so how do I best map the old olddomain subdomains to the newdomain subdomains? Do I need to unpark olddomain, manually create DNS zone for it and its 3 subdomains and then redirect those subdomains at the DNS level?

    Note: I have root access on this box.

    Any advice appreciated

    Thanks
     
  2. RedactUK

    RedactUK Member

    Joined:
    Apr 22, 2004
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    Anyone able to help me with this?

    I guess what I'm after is knowing whether I can redirect an old domain with 3 subdomains via DNS or whether I have to create an account for it and the use .htaccess 301 redirects at the root and for sub domains via folder. I really don't want to recreate the account, but I just can't work out how to create the DNS entries for the old domain to cause them to redirect to the new one.

    Thanks
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    If the primary intention is to redirect a subdomain to another subdomain, you can simply add the subdomain itself as a Parked domain name. In the example you provided, you would add "sub1.olddomain.com" as a parked domain name, and then redirect it to the URL of your choice.

    Thank you.
     
  4. RedactUK

    RedactUK Member

    Joined:
    Apr 22, 2004
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    Many thanks for your response.

    I actually didn't realise I could park subdomains. When I first deleted the account for olddomain.com I then parked olddomain.com on newdomain.com and assumed the subdomains it once had would no longer exist. So what you are saying is that as well as parking olddomain.com onto newdomain.com I can also park the 3 old subdomains i.e. sub1-3.olddomain.com as separate entities onto newdomain.com? and presumanly as newdomain.com has identical subdomain names as olddomain.com, an htaccess 301 redirect in the folders sub1-3 will work for both?
     
  5. RedactUK

    RedactUK Member

    Joined:
    Apr 22, 2004
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    Having done the above, when accessing any of the parked sub domains I get:

    http://sub1.olddomain.com/cgi-sys/defaultwebpage.cgi

    So far I've cleared local browser cache and flushed dns locally, plus can confirm the same via proxy
    Also restarted Apache (though not done complete reboot)

    Just for clarification, when I go to edit DNS zone I now have separate entries for:

    old.domain.com
    sub1.olddomain.com
    sub2.olddomain.com
    sub3.olddomain.com

    and these are shown as parked against the newdomain.com equivalents

    Each simply has a CNAME entry for mail, www, ftp to the same value

    The root olddomain.com IS correctly redirecting to newdomain.com, it's just the siubdomains that report the page above.

    What have I missed?
     
    #6 RedactUK, Sep 12, 2012
    Last edited: Sep 12, 2012
  6. RedactUK

    RedactUK Member

    Joined:
    Apr 22, 2004
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    What's even stranger is that if I put a dummy index.html file in the root of:

    sub1.newdomain.com

    Then trying to access sub1.olddomain.com/index.html

    works, in that in the picks up the redirect in the sub1.newdomain.com folder

    So why is simply accessing http://sub1.olddomain.com/ failing to read the .htaccess file and coming up with that cgi-sys/defaultwebpage.cgi page?
     
  7. RedactUK

    RedactUK Member

    Joined:
    Apr 22, 2004
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    Well it seems to be resolved now after doing a server reboot. Seems just re-starting Apache was not enough.
     
Loading...

Share This Page