Hi,
You can try using the page rules which comes built-in in cloudflare itself. Instead of using www as a cname use it as a A entry and use CF page rules to redirect all your traffic to www instead of without www. Remember to use the permanent redirect. Moreover if it's wordpress then install cloudflare wordpress plugin which automatically gives 404 errors on the page which does exits. I hope it may help you if you didn't got what i said then feel free to PM me, i'll help you to get it sorted.
Regards
Bharat