header("Location: $value"); wont redirect... Why?
After login I want 开发者_开发百科to send users back to $value
,
$value
is generated with my code, printed and looks ok.
It's a complete URL: http://example.com/page.php?id=6
,
but it ignores the header("Location: ".$value);
statement:
if($iniciando->iniciar()) {
if (isset($_SESSION['redirect'])) {
$he ="http://funcook.com" . $_SESSION['redirect'];
mostrar_notificacion($he);
header("Status: 301");
header("Location: " . $he, true, 301);
} else {
imprimir_sesion_iniciada();
}
} else {
imprimir_formulario_sesion();
}
header("Location x");
has to be called before any other output is sent to the browser. This includes any spaces outside the <?php
and ?>
markers.
Also, make sure you also don't have any print/echo statements for debug purposes.
I suspect you're using Chrome?
You should use a better redirect code for all browsers to follow it:
header("Status: 301");
header("Location: ".$URL, true, 301);
精彩评论