Point a Domain to a Sub-Domain | DNS Records

Discussion in 'Site & Server Administration' started by dan101, Mar 14, 2011.

  1. #1
    Hi,

    I have two domains and want to point one domain to a sub-domain of the other domain. I don't want to use Addon Domain option (from my cPanel) but I need to use something that I can change on name.com - to change the dns records like cname or whatever.

    Lets say I have on my server

    domain.com
    sub.domain.com


    And my second domain domain2.com

    what I want is that once user enter domain2.com, he will actually be surfing sub.domain.com. I don't want a redirect, I want the URL etc still remains domain2.com.

    Any help is appreciated.
    Thanks
     
    dan101, Mar 14, 2011 IP
  2. kaung

    kaung Twitter @KaungKo

    Messages:
    4,040
    Likes Received:
    187
    Best Answers:
    0
    Trophy Points:
    155
    #2
    I have a similar setup for my forum on my server and making some selected files auto cached and served from Amazon cloud server. See if this will work for you. Keep in mind any DNS changes take up to 72 hours for proper propagation!

    (This was the way I used. Might not be the only way :) )

    Does the site on sub.domain.com have its own configurable domain name/url/site url section? (If not, you may have to manually edit file url callings or need more work to make this whole thing works)

    Also you want domain2.com/subfolder as well pointing to sub.domain.com/subfolder rather than framing it all with domain2.com, correct?

    Then, Try this.

    1. Go to your domain provider.
    2. Go to DNS edit or configuration page of domain2.com.
    3. Go to Cname (Alias).
    4. Add
    Host: www
    Points To: sub.domain.com

    5. Also make domain2.com redirect to [B]www.domain2.com[/B] through forwarding permanent service of your domain config.

    6. After waiting 24-72 hours or making sure the domain2.com properly redirects to sub.domian.com now, log into the website on sub.domain.com's admin panel or open config file or whatever and change the Site URLS and folder URLS to domain2.com or domain2.com/folder.

    Hope this works for you as it worked for me.
    Good luck!
     
    kaung, Mar 14, 2011 IP
  3. dan101

    dan101 Peon

    Messages:
    52
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you very much!

    My hosting provider is bluehost.com ( here I have domain1.com hosted ) and my domain provider is name.com.

    [​IMG]

    In name.com I setup www.domain2.com CNAME subdomain.domain1.com. Also the redirection of domain2.com to www.domain2.com

    But the problem is that when I go to www.domain2.com it redirects me to bluehost server ( see image ) and gives me There is no website configured at this address.. So bluehost does not redirect to the subdomain.

    My intention is to not use the cPanel to add Addon Domains.

    So do you have a solution for that?
    Thanks again!
     
    dan101, Mar 15, 2011 IP
  4. kaung

    kaung Twitter @KaungKo

    Messages:
    4,040
    Likes Received:
    187
    Best Answers:
    0
    Trophy Points:
    155
    #4
    Hmm.. let's see

    domain2.com is under Name.com's nameservers correct?
    Just confirming because sometimes the domain provider lets you change DNS record but only come into affect once you've also changed the nameservers to theirs.

    If you have domain2.com or domain1.com and their nameservers freshly registered/added (most likely domain1.com issue), you'll have to wait until they have fully propagated (the faster propagation the close to you to the server host/ip - other areas still might need longer waits).

    It is almost most likely:
    1. Do you have a sub.domain1.com already created? This can be done through cpanel as an add subdomain (not addon).
    2. and have a site running under it? Try uploading a sample test index.html (attached) to domain1.com/subdomain_name through cPanel.
     

    Attached Files:

    kaung, Mar 15, 2011 IP
  5. dan101

    dan101 Peon

    Messages:
    52
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yes the subdomain is created and already running. But I think you're right .. the DNS is not propagated yet. I will wait :eek:

    If I added the CNAME record the www.domain2.com will still appear in the address bar of my browser or not? I don't want a redirection.
     
    dan101, Mar 15, 2011 IP
  6. kaung

    kaung Twitter @KaungKo

    Messages:
    4,040
    Likes Received:
    187
    Best Answers:
    0
    Trophy Points:
    155
    #6
    Let me know if it still doesn't work.

    Yes, it'll show domain2.com.
    A Sample Image - The browser still show domain.info (domain2.com in your case). :)

    Backup if you want and make sure to configure all the site URL and such to domain2.com in your sub.domain1.com's admin panel or some sort.
    Say in admin panel you'll see and will probably have:
    Site URL: http://www.domain1.com
    Images Folder URL: http://www.domain1.com/images/

    You just change to
    Site URL: http://www.domain2.com
    Images Folder URL: http://www.domain2.com/images/

    Leave the server side paths as is if there are any.

    It'll be taken care of. The URL will stay as domain2.com and as for browser title, whatever you've defined in <title>.

    If it doesn't work, you might need rewrite rules.
     
    kaung, Mar 15, 2011 IP
  7. madaboutlinux

    madaboutlinux Member

    Messages:
    250
    Likes Received:
    7
    Best Answers:
    2
    Trophy Points:
    43
    #7
    The easiest method is Frame Forwarding a domain. Create a index.html file under domain2.com and add the following code to it

    this will show the contents of subdomain when anyone browse domain2.com and won't change the URL in the address bar as well.
     
    madaboutlinux, Mar 16, 2011 IP
  8. dan101

    dan101 Peon

    Messages:
    52
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    At this moment still don't work .. the same message from bluehost

    Yesterday I made a test with some subdomains. So I pointed CNAME to google.com and sofpedia.com .

    google.mydomain1.com - is redirected to google.com - and in the adress bar is google.com instead of my subdomain.

    The same problem with sofpedia.com

    Why in my case CNAME is redirecting?

    I don't know what to do ..
     
    dan101, Mar 16, 2011 IP
  9. kaung

    kaung Twitter @KaungKo

    Messages:
    4,040
    Likes Received:
    187
    Best Answers:
    0
    Trophy Points:
    155
    #9
    So, you're still seeing the "there is no website configured notice" even though you have a site running at sub.domain1.com?
    We have to solve that first. There's something going on. That's most likely bluehost's support issue.
    Because taking into redirection in account only, it should redirect properly to sub.domain1.com. (Have you created a subdomain of the domain1.com through your cpanel? It's not an addon).
    Try and see what comes up if you make it go to domain1.com/sub. Still the same "no site" message?

    After the above is solved, then you can edit the domain names through script's site configuration.
     
    kaung, Mar 16, 2011 IP
  10. dan101

    dan101 Peon

    Messages:
    52
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Many thanks kaung for your support!
    Yes the page "there is no website configured notice" appears even though I have a site running at sub.domain1.com
    Also sub.domain1.com is created from my cPanel and working well (no errors).
     
    dan101, Mar 16, 2011 IP
  11. dan101

    dan101 Peon

    Messages:
    52
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    The answer from bluehost : The cPanel will not work with sub subdomains. You can redirect the domain2.com to the sub subdomain sub.domain1.com but a CNAME will not work with the setup here.

    Do you know that hostgator accepts CNAME ?
     
    dan101, Mar 16, 2011 IP
  12. kaung

    kaung Twitter @KaungKo

    Messages:
    4,040
    Likes Received:
    187
    Best Answers:
    0
    Trophy Points:
    155
    #12
    That's strange.
    Is domain1.com some sort of an addon already then?

    How about CNAME it straight up to subfolder created at the time of subdomain creation?
    domain2.com to domain1.com/subfolder
    And configure your site's values to domain2.com as before?

    You can and should probably try it out by creating a subfolder in domain1.com.
    Installing the script in there.
    And create a new CNAME to test out, pointing to domain1.com/subfolder.
    Change the script's values to point to domain2.com as site URL and any image folders or anything else.
     
    kaung, Mar 16, 2011 IP
  13. saqib889

    saqib889 Peon

    Messages:
    1,291
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Kaung impressive you took a lot of time to help.
     
    saqib889, Mar 17, 2011 IP
  14. dan101

    dan101 Peon

    Messages:
    52
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    HI again kaung,

    I appreciate you help. If I want to CNAME to the subfolder name.com it gives me that error Invalid character used for record answer. . I think the slash is not allowed.
     
    dan101, Mar 17, 2011 IP
  15. kaung

    kaung Twitter @KaungKo

    Messages:
    4,040
    Likes Received:
    187
    Best Answers:
    0
    Trophy Points:
    155
    #15
    Oops. My bad. I forgot about that. I was in a hurry when I replied that.

    I still find this strange.
    I wonder how or why they won't even let a redirect.

    Does it work if you simply use the redirect/forward of your domain? (Just wondering).
    Because cname redirect and that looks the same to me.

    I did several test Cname redirects from domain2.com to sub.domain.com, sub.sub.domain.com, and sub.sub.sub.domain.com and they all work fine.
     
    kaung, Mar 17, 2011 IP
  16. dan101

    dan101 Peon

    Messages:
    52
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #16
    My last option - just move to another host :)
     
    dan101, Mar 18, 2011 IP
  17. kaung

    kaung Twitter @KaungKo

    Messages:
    4,040
    Likes Received:
    187
    Best Answers:
    0
    Trophy Points:
    155
    #17
    Are you allowed to have more addons or are you maxed out?
    Do you really need that redirection?
    I mean will it be worth it to move around hosts for that or do you ahve other plans?

    Just osme thoughts. :)
     
    kaung, Mar 18, 2011 IP