Creating subdomains

Discussion in 'Mac OS X Server, Xserve, and Networking' started by paul-westperth, Nov 16, 2011.

  1. paul-westperth macrumors newbie

    Joined:
    Nov 16, 2011
    #1
    Hi,

    I cannot seem to find step-by-step instructions for adding a sub-domain. I have DNS and Web server running.

    I want to have a subdomain forward to a specific directory in the document root, not a different server.

    Thanks
     
  2. jtara, Nov 17, 2011
    Last edited: Nov 17, 2011

    jtara macrumors 65816

    Joined:
    Mar 23, 2009
    #2
    It's not possible to have a subdomain "forward to a specific directory". That's not something that's possible with DNS. DNS only points to an IP address. DNS doesn't know anything about URLs.

    Many DNS providers have a kind of "forwarding" to do this sort of thing, but they don't actually use DNS to do it. They just run a web server that redirects to your server. And they frame your site to keep it from re-writing the address bar content. It's cheesy. Don't do this. And, anyway, it sounds like you want to make use of your own DNS server - though I don't recommend that unless it's an internal-only site. Best to use a commercial DNS service, which will give you multiple geographically-dispersed servers. But I digress...

    Set the subdomain to go to the SAME IP address.

    Then set-up virtual hosts on the web server for the main and subdomains. Configure whatever document roots you want for each virtual host. The directories served by each virtual server can be completely different, the same, or a mix. That is, you can set up whatever URL structure you want within each virtual server, and they can share or not share content as you wish.

    The web server will look at the domain name and direct requests to the appropriate virtual host.
     

Share This Page