Forum Moderators: coopster

Message Too Old, No Replies

interchanging between http and https

         

kknusa

4:11 pm on Jan 9, 2004 (gmt 0)

10+ Year Member



Hi everybody

i have a form that gets executed in an SSL environment so
h2tp://www.mysite.net/form.php goes to
h2tps://ssl.site.net/mysite.net/validate.php now i want to go back to use http so want to get
h2tp://www.mysite.net/index.php

But what happens is that it still remains in the HTTPS mode i've tried the following code

header("Location: h2tp://" . $_SERVE['HTTP_HOST']
. dirname($_SERVER['PHP_SELF'])
. "/" . "somepage.php");

have also tried

header ("Location: somepage.php");

But they all return it like
h2tps://ssl.site.net/mysite.net/somepage.php
instead of
h2tp://mysite.net/somepage.php

Any thoughts?

kknusa

3:52 pm on Jan 10, 2004 (gmt 0)

10+ Year Member



So any input on this one guys

justageek

3:56 pm on Jan 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



header("Location: h2tp://" . $_SERVER['HTTP_HOST']
. dirname($_SERVER['PHP_SELF'])
. "/" . "somepage.php");

Try that.

JAG

kknusa

4:38 pm on Jan 10, 2004 (gmt 0)

10+ Year Member



As i mentioned earlier i have tried that but that doesn't work either in a sense it still has the h2tps://ssl.site.com/...

justageek

4:58 pm on Jan 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



But your post is missing an 'R'. You have $_SERVE and it should be $_SERVER.

And a slash also.

header("Location: h2tp://" . $_SERVER['HTTP_HOST']
."/" . dirname($_SERVER['PHP_SELF'])
. "/" . "somepage.php");

JAG

kknusa

5:46 pm on Jan 10, 2004 (gmt 0)

10+ Year Member



Sorry mistake while copying and pasting but it is with an R in my file, cause it is working but instead of getting
h2tp://mysite.com i get
h2tps://ssl.site/mysite.com

kknusa

4:37 pm on Jan 11, 2004 (gmt 0)

10+ Year Member



Sorry mistake while copying and pasting but it is with an R in my file, cause it is working but instead of getting
h2tp://mysite.com i get
h2tps://ssl.site/mysite.com

jamesa

5:13 pm on Jan 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



replace that with:

echo $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/" . "somepage.php";

...just for testing. I'd guess that either $_SERVER['HTTP_HOST'] is not giving you what you expect, or the block of code you think is being executed actually isn't.

seomike2003

4:49 pm on Jan 12, 2004 (gmt 0)



<?
if (!$SERVER_PORT == '80'){
$thehost = str_replace('www.','',"$HTTP_HOST");
$url = 'http://'."$thehost"."$PHP_SELF";
echo "<meta http-equiv=refresh content=\"0;url=".$_url."\">";
exit;
}
?>

Just add this code to your index page :)

kknusa

9:22 pm on Jan 13, 2004 (gmt 0)

10+ Year Member



Well guys i got it
The problem with this is
Header("Location: h2tp://mysite.com/...")
is that it needs to have www so
Header("Location: h2tp://www.mysite.com/...")

Why the second works and the first doesn't i don't know but it works and thats good. any explanation for that behavior is welcome

justageek

9:50 pm on Jan 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you sure you have a dns record for yoursite.com and not just www.yoursite.com? Also maybe a host header record missing if you're using them.

JAG