title: PHP: Unable to redirect to another page under a condition
body: <p>I'm having troubles in using a redirect in a PHP page. Basically, I'm using the following function to redirect:</p>
  <pre><code>function redirect($url) {
      ob_start();
      header('Location: '.$url);
      ob_end_flush();
      die();
  }
  </code></pre>
  <p>Then, at the beginning of the PHP page, I'm checking for a var value. If that's over a threshold, I redirect to another page:</p>
  <pre><code>&lt;?php 
  . . .
  if (var &gt;= 100) {
     redirect('error1.html');
  }
  ?&gt;  
  &lt;html&gt;
   &lt;body&gt;
    &lt;!-- HTML page here --&gt;
   &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>Although the var is over 100 (it is printed on the screen), no redirect takes place. Any idea why? Is it because there's HTML content included in the page?</p>