Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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.

share|improve this answer
    
See update above. Is it possible to do so using any DNS zone modifications? –  frosty Oct 2 '13 at 20:44
    
@frosty, see the update. –  GµårÐïåñ Oct 2 '13 at 20:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.