1

I am having trouble figuring out my DNS record types. I want the www subdomain to be my "canonical" page, so my configuration looks like this:

www    A record type    actual ip address
@      301 redirect     www address

Is this correct? Do I need to replace the 301 redirect with a CNAME record type? From what I understand, CNAME is supposed to be used for www and @ is supposed to be the canonical, but I want it the other way around.

I am also concerned about SEO, but I am not sure how having a CNAME record instead of a 301 redirect affects this.

An additional issue I am having with this setup is that I can't use login@example.com for SSH and I need to use login@www.example.com. But this is just a minor nuisance.

masegaloeh
  • 18,498

2 Answers2

2

A CNAME is not a redirect. It is just a canonical (or copy) of an A record. Set your A record for @ to the IP and the www as a CNAME to example.com. Then, in the web server configuration you can configure the root domain to redirect to the www subdomain. This way example.com and www.example.com point to the same place but users will only see www.example.com in their web browser.

2

You can't CNAME @ without the world ending. Seriously, don't do that.

The best compromise is to either have both of them be an A record, or to CNAME www to @. If you manage the webserver on that IP, configure it to serve up a redirect if the Host header is for the base domain.

Andrew B
  • 33,868