Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Sep 2009
    Posts
    36
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Header Redirect [Simple]

    I know this is pathetic, but it's kicking my *** right now. All I want is a simple redirect.

    PHP Code:
    <?php
    header
    ("Location: http://www.google.com/"); /* Redirect browser */

    /* Make sure that code below does not get executed when we redirect. */
    exit;
    ?>
    And yet it renders the:
    Code:
    Warning: Cannot modify header information - headers already sent by (output started at /home/paul/public_html/x.php:1) in /home/paul/public_html/x.php on line 2
    error.

    What combination of ob_start or ob_flush commands do I need to do to get this to work??

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,471
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    What you have there should work ...
    if you have no other code before that example you've shown.

    Even if you have blank lines before <?php ... that will cause the error.

    Make sure <?php is on the very top line.

  • #3
    New Coder
    Join Date
    Sep 2009
    Posts
    36
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Yeah, I'm only using it to redirect...

    http://affiliatestoolbox.com/pkm/grocery2.php

    I tried FF and Chrome, with both having the same problem.

    I'm completely lost, as this is the simplest thing, yet frustrating me the most, lol.

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,471
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    You're running that redirect just like you've shown?
    You're not including it in another script are you?

  • Users who have thanked mlseim for this post:

    Blockis (06-05-2012)

  • #5
    New Coder
    Join Date
    Sep 2009
    Posts
    36
    Thanks
    4
    Thanked 0 Times in 0 Posts
    No, but tango helped me out. Thanks though!

  • #6
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,471
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    Let us know what it was ... I'm curious.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •