I am trying to force a subfolder (/bbb/) of my root domain to show always as https. Also my .htaccess
file take care of the extensions of the pages.
I have
If you have a proxied server or if you're using shared hosting then sometimes you'll get a free SSL via CloudFlare. And if you are using a framework like CodeIgniter or Laravel then you always have a route file. So sometimes the answer I have given above might not work.
In that case when you try to redirect to https
you might get unlimited loops. So to resolve that you could try below:
RewriteEngine On
# If we receive a forwarded http request from a proxy...
RewriteCond %{HTTP:X-Forwarded-Proto} =http [OR]
# ...or just a plain old http request directly from the client
RewriteCond %{HTTP:X-Forwarded-Proto} =""
RewriteCond %{HTTPS} !=on
# Redirect to https version
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]