I know about using CNAME records to redirect domain.com to www.domain.com, but how would I go about redirecting domain.com to sub.domain.com and also www.domain.com to sub.domain.com? Do I do so via editing my DNS zone files or a HTTP redirect with my webserver?

Also, what would be the correct terminology to refer to SUB.domain.com? Is it hostname, leaf domain?

Update: I'm only interested in hosting a simple static site on a dedicated server using Octopress and Nginx. I don't particularly care about SEO and Google PR etc.

1 Answer
1

The best method is to use HTTP redirect rules for those items if you have access to make those changes. If you are in a hosting plan that doesn't allow you to make that direct modification, then you can use the less elegant but equally valid in some cases of using index.php/index.asp/or whatnot allowed by your server, to parse and redirect server-side. Its an ugly hack but in some cases necessary.

UPDATE:

Well there is not real concept of "redirection" in DNS. What you are trying to achieve would be done by tricking it by setting up say SUB.DOMAIN.COM using an "A" record with the address of the webserver. Then setup DOMAIN.COM using "CNAME" pointing to SUB.DOMAIN.COM and then you need to configure your webserver to "redirect" the requests for DOMAIN.COM to SUB.DOMAIN.COM and/or serve the same page for both unless you REALLY want the redirect.

Another solution can be pointing everything to the same server address (so means no messing with the DNS records) and then use .htaccess file with the mod_Rewrite to test what was asked for and then redirect to that resource. Simple as that. So your call how easy or hard you want to make this for yourself. That's why I suggested what I did earlier before the update.