Header redirect fails

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
powrtoch
Forum Newbie
Posts: 5
Joined: Thu Nov 05, 2009 9:55 am

Header redirect fails

Post by powrtoch »

I know this first thing you think is "no output to the browser before the header function". There isn't any. No tags, no spaces, no line breaks, nothing. I don't even have a "headers already sent" error displaying. For some reason though, the redirect simply does not work, and my script indicates that headers are getting sent anyway. I go to the page, and I just get a blank page with the undirected url up top. Is there some php configuration variable that could cause this to fail?

Here is my ENTIRE script.

Code: Select all

<?php
    $a = headers_sent();
    header("Location: http://google.com");
    $b = headers_sent();
    echo "$a<br />$b";
    exit();
?>
The output is:
1
1

Obviously the first one should not be a 1. Any thoughts? I'm going nuts here.
powrtoch
Forum Newbie
Posts: 5
Joined: Thu Nov 05, 2009 9:55 am

Re: Header redirect fails

Post by powrtoch »

Well, if anyone cares I solved it. It wasn't a PHP problem, it was a Dreamweaver Being Crazy problem. Long story short, the fix was to open up a file where redirects did work, save it over the file where they wouldn't, and then change it from there.

Probably character encoding issue or something, I don't know, I just know I wasted my whole morning on it.
Post Reply