title: PHP header read file and redirect
body: <p>I'm trying to redirect my user after they download my files. I manage to make them download the file but I cant redirect them to the url. Pleas help</p>
  
  <pre><code>&lt;?php
  //Search for file using GET
  if(isset ($_GET['file']) &amp;&amp; ($_GET['url'])){
  
      $file = $_GET['file'];
      $link = $_GET['url'];
  
      if (file_exists($file)) {
  
          header('Content-Description: File Transfer');
          header('Content-Type: application/octet-stream');
          header('Content-Disposition: attachment; filename="'.basename($file).'"');
          header('Expires: 0');
          header('Cache-Control: must-revalidate');
          header('Pragma: public');
          header('Content-Length: ' . filesize($file));
          readfile($file);
          exit;
  
      } else {
  
          echo "Why are you here?";
      }
  
  //file downloaded now go to link
  header('Location: $link');
  
  }
  
  ?&gt;
  </code></pre>
  
  <p>How do I fix this?</p>