Last updated 6 months ago
Sometimes your website may not load through https://
even when SSL is installed and activated on your domain, this happens on some servers. To forcefully redirect your website HTTP to HTTPS;
Open the ".htaccess" file on the root directory and add the following code at the end:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
RewriteCond %{SERVER_PORT} 80
Note:- you must replace example.com with your site URL.
If the above does not work for you, kindly use the below code as alternative
RewriteEngine on # force ssl
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
Note:- that this should be your first rewrite rule.
* I hope this Helps