As we know that all transactions over internet uses SSL (secure socket layer) connection to transfer data to and from the payment gateway. commonly most of websites uses “HTTP” protocol but When we need to integrate payment gateways on e-commerce site or any other. Then we need to redirect the browser from common “HTTP” to Secure “HTTPS” which mean that “Hypertext Transfer Protocol over Secure Socket Layer”.

We can see the real example of HTTPS in Banks, reservation sites when we type “HTTP” it automatically converts to “HTTPS” in address bar which means this site is transferring the data over SSL protocal.

Redirect the browser to https when site is using http protocal in PHP

First of all, you will have to configure SSL on your server. After we will check that the site is using SSL or not by PHP server varriable called $_SERVER['HTTPS'] which return “ON” valuewhen the site is using SSL Connection.