Redirect http to https (SSL for entire website)

The Hypertext Transfer Protocol (HTTP) is an application protocol for distributed, collaborative, hypermedia information systems. You may know it from website url’s like: “http://www.google.com”

Using PHP :

< ?php if((array_key_exists('HTTPS',$_SERVER) and $_SERVER['HTTPS']!="on") or $_SERVER['SERVER_PORT']==80) { $redirect= "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; header("Location:$redirect"); } ? >