Redirect To Https Codeigniter

on cloudways be sure you added domain www on ssl

https: //www.phpkida.com/redirect-http-to-https-using-htaccess/
  https: //support.cloudways.com/en/articles/5123922-what-can-i-do-with-an-htaccess-file

  RewriteEngine On
RewriteBase /
  RewriteCond % {
    ENV: HTTPS
  } != on
RewriteRule ^ .*$ https: //%{SERVER_NAME}%{REQUEST_URI} [R,L]

  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - ends here

RewriteEngine On
RewriteCond % {
  REQUEST_FILENAME
}!-f
RewriteCond % {
  REQUEST_FILENAME
}!-d
RewriteRule ^ (.*) $ index.php / $1[L]
RewriteCond % {
  HTTP_HOST
} ^ www.bopel.org[NC]
RewriteRule ^ (.*) $ http: //bopel.org/$1 [L,R=301]

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