How to A-record DNS redirections work?
February 19, 2011 8:21 AM   Subscribe

Some DNS registrars offer a service where they redirect anybody landing at http://yourdomain.com to http://www.yourdomain.com. What do they do to the DNS record to make this happen, particularly if the www is a CNAME record (that is, not an IP address)?
posted by deeper red to Computers & Internet (10 answers total) 1 user marked this as a favorite
 
Can you give an example of a service that does this through DNS?
I don't think it's the DNS registrars doing this, since the DNS protocol has no idea what port you are trying to connect to or what protocol you are trying to use.

More likely, it's the web hosting service doing this, which doesn't even require a redirect; it's just another Server Alias (or Virtual Host).
posted by jozxyqk at 8:27 AM on February 19, 2011


My DNS settings through Nearly Free Speech (my web host) do this. Article of interest.
posted by jmd82 at 8:34 AM on February 19, 2011


I believe they just give the root an A record which points to their web server, which is configured to do the redirect.
posted by makeitso at 8:38 AM on February 19, 2011


If you want the person's browser to actually show the url www.yourdomain.com when they put in just yourdomain.com, that is not possible just with DNS. A redirect is needed on the web server answering for yourdomain.com. So if a DNS provider is to have this server, they actually have a web server answering for yourdomain.com and sending an HTTP 301 redirect to www.yourdomain.com.

On preview, what makeitso said.
posted by zsazsa at 8:38 AM on February 19, 2011


so for my domains I have an A record that points to the non www domain. I can then have a CNAME record for www which points to mydomain.com. This takes care of the DNS records.

I don't "redirect" www.mydomain.com to mydomain.com I use a ServerAlias
posted by bitdamaged at 9:06 AM on February 19, 2011


Response by poster: Bitdamaged, it's the other way around that I'm interested in.
posted by deeper red at 9:35 AM on February 19, 2011


What do you mean the other way around?
posted by bitdamaged at 9:49 AM on February 19, 2011


deeper red: Are the registrars who are doing this also hosting the website in question?
posted by rhizome at 11:38 AM on February 19, 2011 [1 favorite]


Echoing what makeitso and others have said, I assume the registrar is running the webserver pointed to by mydomain.com, but the only thing that webserver does is issue a redirect to www.mydomain.com, which can be hosted anywhere. (I tried reading jmd82's link but it seems to be for logged-in users only.)
posted by hattifattener at 2:58 PM on February 19, 2011 [1 favorite]


If you want the url in the browser to change (that is, you typed 'A', resulting page reads 'B') then you must have something more than DNS in the mix, in particular you need a HTTP server that responds with a 30x code and 'Location' header. If the DNS provider is not hosting the site, then they must have the name resolve to a different IP address of a server under their control that sends the redirect. If they are hosting the site they can have both domains resolve to the same IP address and then do the redirect.
posted by Rhomboid at 4:52 PM on February 19, 2011


« Older Boston North End Apt Search   |   I want to buy a really boring car. Newer »
This thread is closed to new comments.