Page 1 of 1

PHP header problem

Posted: Mon Sep 27, 2004 2:21 am
by Cesar
Hi, I have a problem with send header if my page by UTF-8 encoding.

Code: Select all

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

?>
It is dont work when charset=utf-8, but it work when charset=ISO-8859-1.
Where is the error.

Thanks

Posted: Mon Sep 27, 2004 2:46 am
by feyd
have you tried full urls? Sounds odd, but it may be part of it. Maybe your server is sending out two conflicting content types...?

Posted: Mon Sep 27, 2004 2:51 am
by Breckenridge
try this

Code: Select all

header("HTTP/1.1 303 REDIRECT");
header("Location: http://domain.com/dir/index.php");
header("Connection: close");

PHP header problem

Posted: Mon Sep 27, 2004 2:53 am
by Cesar
--Maybe your server is sending out two conflicting content types...?--
You mean in php.ini

Posted: Mon Sep 27, 2004 2:56 am
by feyd
no, I mean your code may be sending out conflicting content types. You'd need to look at the page headers your script sends out (actually sends out, not what you are asking it to send)

searching under for my posts with threads that talk about headers and curl will find several I've posted code bits on how to retrieve detailed headers.

PHP header problem

Posted: Mon Sep 27, 2004 3:09 am
by Cesar
I dont send a content. i have index.php in root directory and in index.php i have code

Code: Select all

<?php
header('Location: ../src/index.php');
?>
and i have in /src index.php with my site code.
But first index.php dont redirected to ../src/index.php

Posted: Mon Sep 27, 2004 3:12 am
by feyd
you probably need a full url. That's what the standard says it should be anyways.

Posted: Mon Sep 27, 2004 3:18 am
by Cesar
I try with full URL, but it dont work. Problem with function header, it dont work in utf-8 encoding

Posted: Mon Sep 27, 2004 3:20 am
by feyd
wait, you're putting utf8 encoded characters into the header function?

Posted: Mon Sep 27, 2004 3:30 am
by Cesar
NO, I create php page on Dreamweaver and Page preferences is view encoding = utf-8. ONLY.

Posted: Mon Sep 27, 2004 3:44 am
by mudkicker
try writing the url without ".."
i mean

/src/index.php