title: Hide download file location. - Redirect download
body: <p>I am selling a digital product and want to hide the true location of the download.</p>
  
  <p>So I'm using a redirect script like this:</p>
  
  <pre><code>protected function redirectDownload ($realfilename) { 
      ob_start(); 
      $mm_type="application/octet-stream"; 
  
      header("Cache-Control: public, must-revalidate"); 
      header("Pragma: no-cache"); 
      header("Content-Type: " . $mm_type); 
      header("Content-Length: " .(string)(filesize($realfilename)) ); 
      header('Content-Disposition: attachment; filename="'.$this-&gt;fakefilename.'"'); 
      header("Content-Transfer-Encoding: binary\n"); 
  
      ob_end_clean(); 
      readfile($realfilename); 
  }  
  </code></pre>
  
  <p>The zip file is always corrupted when I download it, but when I download it directly it is fine.</p>
  
  <p>Does anyone know why this might be?</p>
  
  <p>I think this was working fine on another server, but would need to confirm that.</p>
  
  <p>If I can't solve this, is there any other techniques or services I can use to do this?</p>