Put these lines in your .htaccess file in the root directory of your site
RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.yousite.com/$1 [R,L]
also, if you have only some directory that you want to protect (for example, the directory where the script login is located), then put the .htaccess file in this directory containing these lines
RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} /path/to/directory RewriteRule ^(.*)$ https://www.yousite.com/path/to/directory/$1 [R,L]
Ilya saunkin
source share