1

I would like to set up my web app to use the "www" subdomain as my primary url. I'll be using a service to handle 301 redirects from my naked/apex domain to my subdomain (example.com -> www.example.com). What is the correct DNS record type for my "www" subdomain? Cant seem to find a clear answer on this.

  • An "A" record pointing to my websites IP address?
  • A "CNAME" pointing to my naked/apex domain?
Sean Tansey
  • 409
  • 2
  • 7
  • 14
  • There is no absolute right or wrong way, it all depends on many factors you don't list (including where it is hosted, if a CDN is involved, etc. etc.) and your question is not related with programming so offtopic here. In short both of your options will work and have no real operational differences. – Patrick Mevzek Aug 11 '22 at 20:04

1 Answers1

2

It's CNAME. A record is pointing to the webserver IP address. CNAME will serve as an alias. Commonly when example.com and www.example.com points to the same application and hosted by the same server. To avoid maintaining two different records, it's a best practice to create an A record for example.com pointing to the server IP address and a CNAME record for www.example.com pointing to example.com