How do you make a subdomain forward to a different host?
November 16, 2007 4:07 PM   Subscribe

How do you assign a subdomain to a different host?

So, here's an odd situation.

My brother runs a small charity that has a website at www.mybrotherschairty.org. The site is being hosted for free by a friend of his, but we don't have much contact with them, and I'm reluctant to ask them for favours. The domain name is registered with Godaddy, and while I have access to domain management there, I don't have any access to the hosting provider.

I have been asked to set up a Movable Type blog for the site, but I don't have permissions to create a new database on our hosting provider, and I don't want to jam a bunch of tables into the ones we have. Therefore, I have agreed to host the blog at my personal server at www.myserver.net/blog. I have complete control of everything related to my server, including DNS.

Okay, so what I want to do is to have the subdomain blog.mybrotherschairty.org go to myserver.net/blog. But I want to use masking so that the url doesn't change for visitors who will have no idea what myserver.net is. Yesterday, I went to Godaddy and added a subdomain though the interface there. However it's been over 28 hours and nslookup on blog.mybrotherschairty.com still says "no answer", so I think I need to do something else.

This should be pretty easy to do, I think, but I have no idea how DNS works, or what a CNAME record is, or how to bake a delicious pie with said record. Please talk to me like I'm an idiot. What, exactly, should I do to make this work?
posted by tracert to Computers & Internet (12 answers total) 2 users marked this as a favorite
 
How did you add the subdomain through godaddy? Did you make blog.mybrotherscharity.com a CNAME for myserver.net? If so, that should be sufficient.

If you have full control of your own server, you should set it up to have a virtual host of blog.mybrotherscharity.com, and put the blog there rather than as a subdirectory under myserver.net. That way, visitors won't ever know or see anything about myserver.net. That's the most transparent way that requires the least amount of runaround with DNS, and you won't have to do any hacky "DNS masking."
posted by zsazsa at 4:18 PM on November 16, 2007


By the way, you're spelling charity as chairty. Is that word in the real URL? Maybe that's why your nslookups aren't working.
posted by zsazsa at 4:19 PM on November 16, 2007


Where are the nameservers for your domain pointed? This is going to determine where you apply the necessary changes.

If your nameservers are pointed toward godaddy's dns servers, you need to set up an A record in your total dns control panel with a hostname of blog that points to the forwarding IP address (64.202.189.170).

If your nameservers are elsewhere, you need to gain access to the DNS management at that elsewhere and create the A record that has a hostname of blog that points to the forwarding IP address (64.202.189.170).

Typical DNS propagation timeframes apply.
posted by phredgreen at 4:24 PM on November 16, 2007


Godaddy is only the domain registrar, I can't add any DNS records. There's just a box that says "add a subdomain", then I can pick *.mybrotherscharity.org and set an address to forward to. I thought that would be it, but evidently it is not.

Haha, I am a bad speller. That's not the real url, I just didn't want to self link.
posted by tracert at 4:25 PM on November 16, 2007


Okay, if that's the case, then my second suggestion applies. You can use godaddy to forward and mask the subdomain, but must set up (or ask to have set up) the A record as suggested in the server's DNS management
posted by phredgreen at 4:29 PM on November 16, 2007


Shoot. What happens if I use the dns servers I do have access to? Would that break the regular site?
posted by tracert at 4:32 PM on November 16, 2007


If you change the domain's nameservers, the main site is going to go down until you resolve the A record for the primary domain (@) back to the existing server's IP address. You may also bork the records that get mail where it needs to go.

Given what you've already said about your experience with this stuff, you should stay away from that option.

Ask the people who manage the server to create an A record with a hostname of blog (or whatever the real subdomain is) that points to 64.202.189.170. It's not a big chore, really.
posted by phredgreen at 4:39 PM on November 16, 2007


Okay, good call. I guess I'll have to suck it up and ask. Thanks, guys.
posted by tracert at 4:43 PM on November 16, 2007


Then you need to find the DNS management section of the domain's DNS server. It's likely at the hosting provider where mybrotherschairty.org is hosted. On my host Site5, it's known as "DNS Zone Files."

Once you're there, you need to get to the DNS management section and add an A record pointing to the IP address of your myserver.net host. When you create the A record, it will prompt for the Host Name (blog) and the IP address to point to. If you're not sure of the IP address, just create a ticket with the myserver.net tech support and ask for your IP.

Now that blog.mybrotherschairty.org is pointing to myserver.net, you now need to make it point to myserver.net/blog. To do that you add a domain pointer. Login to your myserver.net host, and find the section for managing domains. Create the domain pointer mybrotherschairty.org and set it to point to myserver.net/blog.
posted by junesix at 5:00 PM on November 16, 2007


Is Godaddy handling the DNS, too? It's normal to do this for domains registered through them. Assuming so (or if you can relay this to whoever does your DNS), create a CNAME record in mybrotherscharity.org that points blog.mybrotherscharity.org to myserver.com:

blog.mybrotherscharity.org IN CNAME www.myserver.com

That's in BIND parlance, but the logic is the same everywhere. At Godaddy you have "Total DNS Control" where you can create server records and aliases.

Next you want to set up a name-based virtual host (Apache docs) on www.myserver.com that serves www.myserver.com/broblog when it gets a request to blog.mybrotherscharity.org. This hostname will be in the HTTP request itself, so as long as the client can get to your server via blog.mbc.org (via the CNAME) then your server can read the request and serve different content based on what hostname is in the request.
posted by rhizome at 5:05 PM on November 16, 2007


Junesix, fun fact: the people hosting my brothers site also use Site5. So, would that work with a CNAME instead of an A record? I use Nearly Free Speech, and because of their architecture they prefer that you not use your sites ip for things. Also, would the address still read as coming from the charity site?

Rhizome, that sounds pretty good, but actually I shouldn't have said I have "full control" of my server. It's not a dedicated host, so I can't edit httpd.conf. I just meant I had access to my DNS records for that domain. Sorry, I (obviously) don't really know what I'm talking about here. Where I work, I usually just wave my hands in the air and then tell people to ask the web team to do things like this.
posted by tracert at 6:00 PM on November 16, 2007


Common DNS quirk that trips everyone up: DNS interprets hostnames as relative to the current domain by default, so naïvely putting a CNAME to www.secondhost.com will (depending on the web interface) likely end up pointing to www.secondhost.com.firsthost.com, which is rarely what you want.

To force an absolute FQDN append a '.' to the end: subdomain IN CNAME www.secondhost.com. or similar.
posted by Skorgu at 8:57 PM on November 16, 2007 [1 favorite]


« Older JavaScript: jQuery vs Scriptac...   |  Am I ruining my laptop with th... Newer »
This thread is closed to new comments.