Cloudflare Docs
Cloudflare Fundamentals
Visit Cloudflare Fundamentals on GitHub
Set theme to dark (⇧+D)

Manage subdomains

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 root domain

Sometimes, you might want to create a subdomain (www.example.com) that simply redirects traffic to your root domain (example.com).

  1. Create a proxied DNS A record for your subdomain. This record can point to any IP address since all traffic will be redirected prior to reaching the address.

    TypeNameIPv4 addressProxy status
    Awww192.0.2.1Proxied
  2. Use Bulk redirects to forward traffic from your subdomain to your root domain. You will likely want to include Subpath matching and Preserve path suffix to ensure requests to www.example.com/examples go to example.com/examples.

    Source URLTarget URLStatusSelected parameters
    www.example.comhttps://example.com301Subpath matching and Preserve path suffix

​​ Redirect root domain to a subdomain

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

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

  2. Create a proxied DNS A record for your root domain. This record can point to any IP address since all traffic will be redirected prior to reaching the address.

    TypeNameIPv4 addressProxy status
    A@192.0.2.1Proxied
  3. Use Bulk redirects to forward traffic from your root domain to your subdomain. You will likely want to include Subpath matching and Preserve path suffix to ensure requests to example.com/examples go to www.example.com/examples.

    Source URLTarget URLStatusSelected parameters
    example.comhttps://www.example.com301Subpath matching and Preserve path suffix

​​ SSL/TLS for subdomains

If your main domain is using Cloudflare’s Universal SSL certificate, that certificate also covers all first-level subdomains (blog.example.com).

For deeper subdomains (dev.blog.example.com), use a different type of certificate.

​​ Customize subdomain behavior

If you want to customize Cloudflare settings for individual subdomains, your approach will vary depending on your plan.

Enterprise customers can set up custom settings and access for a specific subdomain within Cloudflare with Subdomain support.

All other customers can set up subdomain-specific Page Rules to alter Cloudflare settings.

If you want a subdomain’s DNS settings managed totally outside of Cloudflare — meaning this subdomain can be managed by individuals without access to your Cloudflare account — refer to Delegating subdomains outside of Cloudflare.