Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

paul-westperth

macrumors newbie
Original poster
Nov 16, 2011
4
0
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
 
Hi,

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

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.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.