Http request does not redirect to Https

Hello,

My website works fine with https, but when I log in with http, https does not redirect.

I noticed something, the website public_html file is located in both root folder and home folder.
I add the standard redirect code to the .htaccess file but it doesn’t work at all.

Can you help me how to edit the vhost.conf and make the root part home/domainname/public_html?

I think the problem is with the Vhost Conf docRoot setting.

Welcome @rem00te

Post a screenshot of your .htaccess

@josephgodwinke

Hello,
I shared below. Thank you from now.

You modified the default rule from cyberpanel

It should be

RewriteEngine On
RewriteCond %{HTTPS}  !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

Yes I made the change but the problem still persists. I did sysctemctl resrtart lsws and even restarted the server.

Try this


RewriteEngine on
# match query string params in any order
RewriteCond %{QUERY_STRING} ^$
# internal rewrite
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
# L for match path case insensitive

Sorry sir, that didn’t work either.

Anyway this should work

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

I dont understand how that doesnt work. Did you change anything in your ols/ls config for this virtual host also run a cyberpanel update

add forcefully https redirect rules and then restart webserver as well should work

Thank you for your comments. First of all, I will update Cyberpanel. Then I will try the steps you said again.

@josephgodwinke @shoaibkk
Hello again,

I updated the Cyber Panel. Again, I added the forced https redirection from the Rewrite Rules section in CyberPanel. But nothing changed.

The website works with https:// but when it sends a request with http:// it gives a time out error.

Post screenshot of the error when you visit the webpage

@josephgodwinke
We are getting the following timed out error.

Thanks for help. We gave up on CyberPanel and quickly solved the problem with another panel. You can close the topic. have a nice day.