Redirect request from main domain to sub domain

I have set page rules for my main domain to redirect to my subdomain but it doesn’t seem to be working.

Is your domain and www proxied through Cloudflare in your DNS settings (orange cloud)? Page Rules will only fire on proxied requests.

Does it have to be a cname or A entry?

Either should work, as long as it’s proxied through Cloudflare. If you don’t really have an origin, you can use a blackhole/private address like 192.0.2.0 or 100::.