SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,777
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Need help with Redirect

    Why doesn't this code work...
    PHP Code:
    <?php
        
    // Access Constants.
        
    require_once('config/config.inc.php');
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>
       <!-- ################## DEBBIE ##################### -->
       <!-- HTML Metadata -->
       <title>Double Dee, Inc.</title>
       <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

       <!-- Page Stylesheets -->
       <link type="text/css" rel="stylesheet" href="css/_main.css" />
       <link type="text/css" rel="stylesheet" href="css/_layout.css" />
       <link type="text/css" rel="stylesheet" href="css/top_menu.css" />
       <link type="text/css" rel="stylesheet" href="css/components.css" />
    </head>

    <body>
      <div id="pageWrapper" class="clearfix">
        <div id="pageInner">
             <!-- BODY HEADER -->
            </div>
        </div>
    </body>
    </html>
    <?php
        header
    ("Location: " BASE_URL "/index.php");
    ?>

    Debbie

  2. #2
    SitePoint Wizard wonshikee's Avatar
    Join Date
    Jan 2007
    Posts
    1,223
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Headers must be sent before content.

    Content is any HTML

    If you send any HTML - like you did by sending an entire webpage - headers are invalid. Thus they won't work.

  3. #3
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,777
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wonshikee View Post
    Headers must be sent before content.

    Content is any HTML

    If you send any HTML - like you did by sending an entire webpage - headers are invalid. Thus they won't work.
    The scenario I posted won't even result in an error message like "Headers Already Sent"??

    Debbie

  4. #4
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    336
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    The scenario I posted won't even result in an error message like "Headers Already Sent"??

    Debbie
    You may have display_errors set to OFF in your php.ini

    You should have seen something along the lines of:
    Code:
    Warning: Cannot modify header information - headers already sent by (output started at /Path/to/your/file.php:29) in /Path/to/your/file.php on line 30

  5. #5
    SitePoint Wizard
    Join Date
    Dec 2003
    Location
    USA
    Posts
    2,582
    Mentioned
    29 Post(s)
    Tagged
    0 Thread(s)
    Or there could be an error higher up the chain which makes it never get there.


Bookmarks

Posting Permissions

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