views:

273

answers:

4

It's a login page,after validating,the user is redirected to home page:

@header("Content-type: text/html; charset=utf-8");
@header('Location: index.php');
@header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
@header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past

But the page become blank if IE6!How?And it happens only for the first time,afterwards it'll work normally!

+1  A: 

Why are you suppressing the warnings/errors that might be happening? I'd say get rid of the @ first, and then tell us what is really going on.

Matthew Scharley
+1  A: 

header() won't work if there's any output already been sent. This includes spaces, empty lines or whatever. Make sure that there's strictly nothing being output before calling header.

Works:

<?php
header('Location: index.php');
?>

Does not work

 <?php
header('Location: index.php');
?>

And remove the @, it eats up any useful info header tries to give you.

fvu
A: 

You can also redirect using javascript from client side:

Instead of :

@header('Location: index.php');

Client-side redirect:

echo "<script>document.location.replace('index.php');</script>";
jerjer
Using the location header is orders of magnitude better. This will work in all browsers and user-agents, no matter what. Any HTTP library worth half it's salt recognises Location. Very few agents outside browsers will recognise the Javascript, and alot of the ones who do won't necessarily execute it.
Matthew Scharley
A: 

I have been searching for an answer to a similar problem to yours for an hour or so. IE6 seems to have a problem with zipped content. Simply disabling mod_deflate on our server fixed the problem for IE6. Specifically version 6.0.29 appears to exhibit this bug.

Take a look at http://www.contentwithstyle.co.uk/content/moddeflate-and-ie6-bug

ccm