http to https forwarding using php -
i have set ssl on domain. on shared hosting seems causing problems redirecting site https
. have asked previous questions regarding problem without success. attempt seems result in site entering infinite redirect loop. have been given following code service provide host site, solve problem of redirection, not across browsers. on chrome, code works intended forwarding http
page https
counterpart. tests in internet explorer seem forward pages https
homepage , firefox seems show error screen. code follows
<?php if ($_server['http_x_forwarded_ssl'] == '1') { header("location: $redirect"); } else { $redirect = "https://".$_server['http_host'].$_server['request_uri']; header("location: $redirect"); } ?>
could elaborate on code find solution long running problem.
i can't tell why not working try code below redirect http:// https://
if(!isset($_server['https']) || $_server['https'] == ""){ $redirect = "https://".$_server['http_host'].$_server['request_uri']; header("location: $redirect"); }
this work on every browser.hope helps you
Comments
Post a Comment