Cloudflare services are enabled for a given domain name and once activated can also be applied for any of its subdomains.
Before you can use Cloudflare for a subdomain, you would have to enable the service for your main domain.
Once the service is active, to also use it with a subdomain, follow these steps:
1. Go to your cPanel, click on the Cloudflare icon and then the Manage button next to your domain.
2. The first tab on the next page, titled Subdomain, is where you can find a list of the existing subdomains for your domain and whether Cloudflare is active for any of them. Next to each subdomain there will also be an Activate button to activate the service. Click it.
3. In the Points To column you will now have a hostname like:
where sub.domain.com is your subdomain. Copy that hostname to your clipboard.
4. Go to your cPanel -> Advanced DNS Zone Editor. If you have more than one domain names associated with the account there will be a drop-down menu. Choose the domain Cloudflare has been activated for, in our example that would be domain.com.
5. Once the zone is loaded find the records for subdomain sub.domain.com – you should see one entry for an A type record and, if you have SPF enabled, one for TXT type record. If you see a TXT record, delete it by clicking Delete next to it and then click on Edit next to the A type record.
6. Change the type from A to CNAME and paste the Cloudflare hostname you copied in step 3 in the Address field.
7. Click Edit Record to save the change and allow a few hours for DNS propagation.
That’s it, you have activated Cloudflare for your subdomain.
You find this article useful? Click here to learn more about ChemiCloud web hosting experts and what else we can do for you!