But it gives me an error. How would I add a subdomain like blog.example.com that sends to example.com/blog ?
The error you are receiving is because CNAME's only support domain names and not URL paths. You can setup a redirect using your hosting account or Cloudflare Page Rules.
14 Step Cloudflare Process in redirecting traffic from subdomain to main domain using Page Rules:
- Login to Cloudflare
- Use the drop-down menu in the upper left of your screen and click your domain that you want the redirect to take place on.
- Click the DNS icon at the top of the screen.
CNAMEusing the drop-down options
- Add the sub domain in
- Add your domain name in
- Leave TTL as automatic and Cloudclare enabled, click
- Click Page Rules icon
- Click Create Page Rule button
alexa.example.com/*in the URL match field
- Click + Add a Setting, find
Forwarding URLand click it
- Select the status code
301 - Permanent Redirect
- Add the Enter destination URL as
- Click Save and Deploy button.