Adding RewriteCode in https does not work for links other than base url 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?
Adding these lines to the default .htaceess file worked for me

# Force HTTPS across the Drupal site
&lt;IfModule mod_rewrite.c&gt;
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
&lt;/IfModule&gt;


Also enable clean URLs for that site