RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.example\.com*
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
With this I swap from http:// to https://www in one single redirect step.
Unfortunately this does not work for sub-pages. So http://example.com/categorypage will get redirected to https://example.com.
How do I fix it? What should be added in .htaccess to fix the redirection from http to https for sub-pages?