I realised on .htaccess file, server settings varry for this line:
RewriteCond %{HTTPS} on
some work with RewriteCond %{HTTPS} on
while others work with RewriteCond %{HTTPS} off
In my case changing from RewriteCond %{HTTPS} on to RewriteCond %{HTTPS} off worked.