I'm trying to redirect non-www to www and http to https on a SITE-WIDE level. That means for every page, not just the root domain. The below works but not when I type other pages like example.com/blog
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
The above works, except it isn't site-wide. Its good for the root domain, but as soon as I type example.com/blog then this all doesn't work. Please provide the site-wide redirects for htaccess non-www to www and http to https. All the similar questions don't focus on site-wide redirect so please focus on this issue.
Thanks in advance.