Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How would a create a bind record to redirect www.country.domain.com to country.domain.com?

share|improve this question
www IN CNAME @, I think. That's more usually done with a rewrite rule at the httpd level, though. – Xyon Jan 11 at 13:59
In what situation and what level? By browser, by network or for the world? – Dave Rook Jan 11 at 14:07
bind is a DNS daemon. What "redirection" are you talking about? – Oliver Salzburg Jan 11 at 14:33

closed as off topic by Indrek, random Jan 11 at 17:48

Questions on Super User are expected to relate to computer software or computer hardware within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

Redirection is an HTTP concept. It doesn't apply to DNS and involves the browser making multiple separate attempts to fetch a resource.

To direct browsers to the correct IP-address you create DNS records that directly ("A" records) or indirectly ("CNAME" records) associate the domain name with the IP-address.

For BIND you'd typically add a "CNAME" record for "www" to the forward zonefile for the parent domain ("country.domain.com" in your example).


Update

To redirect HTTP traffic you typically use one of two methods

  1. Configure HTTP response codes 301 or 307 in the HTTP server.

  2. Insert a meta refreshin the HTML

(The Wikipedia page linked above describes other methods)

In this context redirect means that the browser fetches one URL but is told by the HTTP server to discard the response and immediately fetch a different URL - this different URL would normally then be displayed in the address bar.

share|improve this answer
Redirect www.country.domain.com to country.domain.com – Tony Jan 11 at 16:27
Ah so it appears for me to redirect www.country.domain.com to country.domain.com I would need to do this on the web server. So when you use a domain admin panel on a domain hoster say godaddy.com, redirects there are not done at the DNS level but some fancy trickery using a http redirect. I never new that. I have had a DNS colleague try a A & CNAME but instead of changing www.country.domain.com to country.domain.com in the browser it retains the www. If you continue through the site it does drop the www but I want this to occur immediately for all browsers, a global thing. – Tony Jan 11 at 16:35
@Tony: see update – RedGrittyBrick Jan 11 at 17:10

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