https://developers.cloudflare.com/fundamentals/setup/manage-domains/manage-subdomains/

core-services-preview.png

Once you have added your domain to Cloudflare and updated your nameservers, you also might want to set up a subdomain.

Most subdomains serve a specific purpose within the overall context of your website. For example, blog.example.com might be your blog, support.example.com could be your customer help portal, and store.example.com would be your e-commerce site.

Create a subdomain

If you have already added a subdomain at your host, create a corresponding DNS A or CNAME record for that subdomain (blog, store).

Set up redirects

Redirect a subdomain to the apex domain

Sometimes, you might want all traffic to a subdomain (www.example.com) to actually go to your apex domain (example.com).

Create a [proxied DNS A record](<https://developers.cloudflare.com/dns/manage-dns-records/how-to/create-dns-records/>) for your subdomain. This record can point to any IP address since all traffic will be redirected prior to reaching the address.

| **Type** | **Name** | **IPv4 address** | **Proxy status** |
| --- | --- | --- | --- |
| A | `www` | `192.0.2.1` | Proxied |
Create a [Single Redirect](<https://developers.cloudflare.com/rules/url-forwarding/single-redirects/create-dashboard/>) to forward traffic from your subdomain to your apex domain.

When incoming requests match

Using the Expression Editor:

(http.request.full_uri contains "www.example.com")

Then

Redirect the apex domain to a subdomain