It doesn't solve your problem, the problem is that you have
http: in your HTML.
1. You need to search and replace in the database and every HTML page, from http to https.
2. It is better to remove this code:
Quote:
if($_SERVER['HTTPS'] == 'on')
|
You want to know if there is problem with SSL, it should be on.
3. The redirection should be on the server, not on PHP. Have all your configurations in one place. If you are using Apache, make sure that you don't have multiple .httaccess files, because they can overwrite settings.