Unable to force http to https

I am unable to redirect my website from http to https
ssl is already installed on my website ()
website is working fine, all the articles and website on google opens up in https
but when I intentionally enter website or any article link with only http:// it keeps on loading and page doesnot open up

to resolve this I found the solution to force http to https through cyberpanel
I saw a code on cyberpanel community which suggests pasting any of the following code in rewrite rules:-
rewriteCond %{HTTPS} !on
rewriteCond %{HTTP:X-Forwarded-Proto} !https
rewriteRule ^(.)$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
-----or-------
RewriteCond %{SERVER_PORT} ^80$
RewriteRule .
https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

when I enter into rewrite rules I found a notification displayed as " It is not required to modify rules if you are using OpenLiteSpeed. Click to read more about whats changed in rewrite rules]) from v1.8 onwards." along with following rules which were already there created by cyberpanel :-

Screenshot attached (already present rewrite rules)

Here I found that the code which community suggested was already present so I just reboot my server in digital ocean, but still website was not getting redirected
I also tried changing the already present code -
rewriteCond %{HTTPS} !on
rewriteCond %{HTTP:X-Forwarded-Proto} !https
rewriteRule ^(.)$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
--------to-------
RewriteCond %{SERVER_PORT} ^80$
RewriteRule .
https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

followed by the rebooting of server again

but still, the problem persists

pls help me out with the problem I am facing as I don’t have deep technical knowledge.

This works for me:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Also I see you are using Wordpress, you also have to set https in Settings > General

1 Like

agree with this

actually, it can be done with rewrite menu from cyberpanel
and
use simple ssl (wp plugin)

I’m having the same problem, http to https redirecton not working, using cyberpanel rewrite rules not working. Build: 2 Current Commit: d617e48d37b9f7bb65ffa6a23547bd8a9a99853e

Check your firewall rules

My cyberpanel firewall looks ok, redirection not working.

can you share a screenshot of the firewall rules of your c panel (Note- I am not asking about re write rules)