Forum Moderators: coopster

Message Too Old, No Replies

Header Location does not work in IE

         

rigaconnect

1:08 pm on Feb 3, 2013 (gmt 0)

10+ Year Member



This does not work in Internet Explorer....
Why?




<?php
session_start(); // Start the php session
ob_start();
ini_set("session.cookie_httponly", 1);
$httponly = true;

if (isset($_SESSION['HTTP_USER_AGENT'])) {
if ($_SESSION['HTTP_USER_AGENT'] != md5($_SERVER['HTTP_USER_AGENT'])) {
header('Location: http://www.google.com');
exit;

}
elseif ( $_SESSION['HTTP_USER_AGENT'] = md5($_SERVER['HTTP_USER_AGENT']) ) {
header('Location: http://www.ok.com');
}
}

rigaconnect

1:10 pm on Feb 3, 2013 (gmt 0)

10+ Year Member



I mean header('Location: [google.com');...] does not work
Works only in Chrome...
What is wrong?

g1smd

1:15 pm on Feb 3, 2013 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Most likely: browser has cached a previous status and ignores the new one.


Root URL should end with trailing slash.

Your code produces a 302 redirect. Should it be a 301?

rigaconnect

1:24 pm on Feb 3, 2013 (gmt 0)

10+ Year Member



Tried with IE7, FF, Safari and Chrome and only Chrome works. Cleared all history in FF. No success

Changed to header('Location: [google.com...] Also no success...

Excuse me.. how to produce 301 redirect? What need to change?

rigaconnect

2:50 pm on Feb 3, 2013 (gmt 0)

10+ Year Member



sorry, my mistake
$_SESSION['HTTP_USER_AGENT']
is not equal to
md5($_SERVER['HTTP_USER_AGENT']

$_SESSION['HTTP_USER_AGENT'] is not displaying at all... do not know why

coopster

2:26 pm on Feb 4, 2013 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Are you certain the HTTP_USER_AGENT is being sent with the request in the other browsers? Perhaps you have a setting in your browser(s) or even somewhere in between (firewall) that is not allowing that setting to be sent over in the request stack.