DNS - Point domain name to subdomain husted elsewhere

Discussion in 'Site & Server Administration' started by lxiaol, Jan 4, 2008.

  1. #1
    Hi,

    I have a domain name which I want to point to a subdomain of a website hosted somewhere else.
    Is there a way to do this with DNS settings?
    Cus in the A type, I'm only able to type IPs...
     
    lxiaol, Jan 4, 2008 IP
  2. LittleJonSupportSite

    LittleJonSupportSite Peon

    Messages:
    386
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Honestly, I would use a 301 redirect for this.

    
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) http://sudomain.somedomain.com$1 [R=301,L]
    
    Code (markup):
    Drop that into .htaccess


    I mean you could use non-std dns entry via bind9 and named.conf but in this case the 301 redirect should suffice.
     
    LittleJonSupportSite, Jan 4, 2008 IP
  3. ndreamer

    ndreamer Guest

    Messages:
    339
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    if you have a dedicated ip address on the other server you could use that, but you will then need to set up apache so both the subdomain and the new domain name point to the same home location.
     
    ndreamer, Jan 4, 2008 IP
  4. boltok

    boltok Active Member

    Messages:
    257
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    78
    #4
    You can use a CNAME instead of an A record. E.g.

    @ IN CNAME sub.example.com.
    www IN CNAME sub.example.com.


    (note the "." at the end)

    However, you'll also have to tell the webserver to accept this (if it is hosting multiple virtualhosts). Add a "ServerAlias" directive to the virtual host section for sub.example.com:

    ServerAlias example.org www.example.org
     
    boltok, Jan 4, 2008 IP