For redirecting http to https, please follow the below steps :-
First - Please Open .htaccess file from /public OR /public_html.
Second - Add below code in opened .htaccess at the top.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
Third - Save the .htaccess File .
Fourth - Refresh the webpage, Now you can see there same page is opening with https.
If in case you are getting infinite loop, then it indicates that eiether you are using CloudFlare or a similar CDN. Now For this case please use below one code.
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
0 Comment(s)