title: How to redirect with header location in php when using ob_start?
body: <pre><code>&lt;?php
  
  ob_start();
  
  echo "&lt;body&gt;&lt;p&gt;Hello "
  
  if ($condition) {
     header( "Location: http://www.google.com/" );
     exit;
  }
  
  echo " World!&lt;/p&gt;&lt;/body&gt;";
  ob_end_flush();
  
  ?&gt;
  </code></pre>
  
  <p>When <code>$condition</code> is true I get this:</p>
  
  <pre><code>&lt;body&gt;Hello
  </code></pre>
  
  <p>What I want is when <code>$condition</code> will be true then go to Google!!!</p>
  
  <p>I don't know what is happening, can you explain or give me a solution!?</p>
  
  <p>Thanks.</p>