header("Location: http://www.example.com/"); exit;
does nothing for me. I have placed the code at the very top of my template right after the <?PHP
When i access the page all I get is a popup error message "Document contains no data. Try again later.. blah, blah, blah
I'm running netscape 4.7.
PHP 4.1, Webstar on OSX.
Thanks
header redirect not working.
Moderator: General Moderators
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
header("Location:) not working
exit or no exit it won't work
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
Code: Select all
<?
header("Location: http://www.example.com");
?>To send out headers, the have to be the first thing sent on the page. I learned that from trying to make a page that was restricted access, eventually i found out that headers have to be the first thing sent. Or else you get errors for the header line of code.
http://www.php.net/manual/en/function.header.php
http://www.php.net/manual/en/function.header.php
From the manuel:
Note: The HTTP status header line will always be the first sent to the client, regardless of the actual header() call beeing the first or not. The status may be overridden by calling header() with a new status line at any time unless the HTTP headers have already been sent.