HTACCESS FOR HTTPS

I have a sub domain like this - abc.domain.com

I want to force the url to https. I’m using this:

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

But its not wokring. Can anyone please help?

Try these


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

Try these

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

this is also not working sir

Works on my end, use this guide to save rules: http://docs.cyberpanel.net/doku.php?id=rewrite-rules

As OLS restart is needed, when you save rules from CyberPanel OLS is auto-restarted.

`RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.your-domain.com/$1 [R,L]`
```


try this ?  and remember do restart OLS if you use file manage

i havent restarted ols, will try this, thx to both of you

Works on my end, use this guide to save rules: http://docs.cyberpanel.net/doku.php?id=rewrite-rules

As OLS restart is needed, when you save rules from CyberPanel OLS is auto-restarted.

Sir, i restarted the ols but still didnt worked. Cant use the above guide becuase i have created a sub domain for that i am editing htaccess from file manager

I’ve looked into your ticket and your site is redirecting to HTTPS just fine.