RewriteEngine On

RewriteCond %{SERVER_PORT} 80

RewriteRule ^(.*)$ https://yourdomain.com/$1 [R,L]

 

If your site is in a subfolder, use this code:

RewriteEngine On

RewriteCond %{SERVER_PORT} 80

RewriteCond %{REQUEST_URI} folder

RewriteRule ^(.*)$ https://yourdomain.com/folder/$1 [R,L]

 

Simply replace yourdomain.com with your actual domain name.