Take the 2-minute tour ×

If I have the following records in the DNS:

hostname               Record Type         address
benmccormack.com       A         
www.benmccormack.com   CNAME               benmccormack.com

What should the user expect to see in a browser's address bar when they type in http://benmccormack.com? how about http://www.benmccormack.com? I was expecting that I would see http://www.benmccormack.com change to http://benmccormack.com in the address bar, but perhaps I misunderstand how a CNAME record is supposed to work.

(Note: I just updated the dns for my site about 15 minutes ago, so perhaps the changes haven't propagated yet.)

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

They should see whatever address they type in, unless you've set up some sort of redirect on the webserver.

Also, it looks like either you didn't update your zone file correctly or it hasn't propogated yet, as the www.benmccormack.com is coming back as an A record:

$ dig www.benmccormack.com

; <<>> DiG 9.6.0-APPLE-P2 <<>> www.benmccormack.com
;; global options: +cmd
;; Got answer:

;www.benmccormack.com.  	IN	A

www.benmccormack.com.   3600	IN	A
share|improve this answer
add comment

You've setup the DNS correctly. The "www" part of the URL should not be mandatory so both "benmccormack.com" and "www.benmccormack.com" should resolve to the same web server. That is the way it is intended to be.

If you want to redirect all requests to the non-www form, add this to Apache conf. file

RewriteEngine On
share|improve this answer
add comment

A CNAME is a DNS thing, a URL is a browser thing. Other than using DNS to look up the name in the URL hostname field, the two don't really affect one another.

If you want to do this, here's what I do on Apache 2 configs to redirect from one to the other:

<VirtualHost *:80>
  ServerName www.waywardgypsy.com
  RedirectMatch permanent /(.*) http://waywardgypsy.com/$1
share|improve this answer
that makes sense. I'm working with a hosted site's DNS (on IIS, I think. The main site is IIS). –  Ben McCormack Dec 3 '09 at 3:19
add comment

Your Answer


