Redirecting www to domain apex
In this guide, you will learn how to redirect the www
subdomain to your apex domain (example.com
). This is a common question and can be achieved by using Bulk Redirects.
To do this:
- Log in to the Cloudflare dashboard, and select your account and website.
- Go to DNS.
- Create a DNS record for the
www
subdomain. It must either be anA
record with the192.0.2.1
value or anAAAA
record with the100::
value. The new DNS record must also have Cloudflare’s proxy enabled (orange-clouded) so that it can enact the Page Rule behavior that you will create next.
Create a bulk redirect list, making sure to Edit parameters and select Preserve query string, Subpath matching, and Preserve path suffix.
Create a bulk redirect rule using the list you just created.
To test that your redirect worked, go to the Target URL and double-click the URL as if to copy it. If the URL does not display www
, your change has successfully propagated.