Loganathan Natarajan
asked on
How can I redirect to https from http?
I have a website hosted in godaddy and purchased SSL (https) support for one year. when I add custom https with my pages it works fine. How can I redirect or set by default when I access my site to go with https?
for example someone type, http://www.test.com to go with https://www.test.com
for example someone type, http://www.test.com to go with https://www.test.com
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
if ($_SERVER['SERVER_PORT']!= 443)
{
$url = "https://". $_SERVER['SERVER_NAME'] . ":443".$_SERVER['REQUEST_U RI'];
header("Location: $url");
}
refer
http://blog.cnizz.com/2007/05/14/php-force-redirect-from-http-to-https/
{
$url = "https://". $_SERVER['SERVER_NAME'] . ":443".$_SERVER['REQUEST_U
header("Location: $url");
}
refer
http://blog.cnizz.com/2007/05/14/php-force-redirect-from-http-to-https/
No points for this comment, please but the answer from pratima_mcs, above, is exactly what I use.
ASKER
Thanks
( at the top )
Open in new window