WWW and non-WWW

Is it possible to add my “A record” to Cloudflare for BOTH WWW and non-WWW versions?
the current canonical is non-WWW, but Google has indexed BOTH.
Appreciate your time, thanks!

Short answer - yes.

You can have and it is a good practice to have A yourdomain.com and A www records at Cloudflare DNS dashboard for your domain.

An example:

Also to note, some people prefer and use a CNAME record(s) while I recommend using A records.

Either choose to stick with www or non-www, and make a redirection from one to another, while for Google make sure to index one scheme (due to duplciated items).

Of course, if there is a special case where really a different content is served on www and non-www.

Regarding canonical, if the canonical one is non-www, then you would need to setup redirection from www to non-www to keep consistency.

In my example:

  • I always setup A mydomain.com and A www DNS records at Cloudflare DNS dashboard.
  • While I setup the www and use www in my Web application (each URL link is pointing to www).
  • Canonical is www
  • Google indexes www URLs
  • Redirect all requests from non-www to www

Maybe someone else has god a different practice and approach, depending on the need. Kindly, wait for another reply if so.

Here are the articles for help how to manage DNS records at Cloudflare dashboard:

Regarding a redirection from www to non-www, or vice versa, see here:

More about if using Cloudflare Page Rules can be found on the below articles:

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.