how to force https for a sub-domain pointing to the directory?

I’ve set a CNAME in CloudFlare, say blog.domain.tld, to the blog directory(/home/domain.tld/public_html/blog) under my webroot, which is /home/domain.tld/public_html.

I also want to force blog.domain.tld to be https, so then edited the .htaccess file (because cyberpanel’s direct access to rewrite rules under configurations is only for domain.tld but not for subdomains) under blog directory as the following

<IfModule mod_rewrite.c>
RewriteEngine on

# the following two lines are for subdomain to 
# point to the sub-dirs under webroot dir.
RewriteCond %{REQUEST_URI} ^/blog
RewriteRule (.*) https://blog.domain.tld

# the following two lines are for force-https purposes
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}


However, it seems the rewrite does not function. Now both http and https are accessible.

So I guess if there are something wrong with my config or the codes? Can anyone help?