Hi guys, I am trying to get a page on my site to redirect to an https site. My site is an http.
HTTP to HTTPS php redirect?
3
Hi guys,
I am trying to get a page on my site to redirect to an https site. My site is an http.
I tried this code:
It redirects but it adds this to the end of the url: mysite.com:443/redirect.php
so after it has redirected, in the browser it looks like this So it gets a 404 error on the https site.
I tried another one I found but it did the same thing, without the 443. Just he mysite.com/redirect.php on the end.
Any thoughts?
I am trying to get a page on my site to redirect to an https site. My site is an http.
I tried this code:
PHP Code:
<?php
if ($_SERVER['SERVER_PORT']!=443)
{
$url = "https://www.securesite.com". $_SERVER['SERVER_NAME'] . ":443".$_SERVER['REQUEST_URI'];
header("Location: $url");
}
?> so after it has redirected, in the browser it looks like this
PHP Code:
https://thesecuresite.com:443/redirect.php
I tried another one I found but it did the same thing, without the 443. Just he mysite.com/redirect.php on the end.
Any thoughts?
- Ashley Gable
- m4rx
Next Topics on Trending Feed
-
3