title: PHP force download, htaccess deny all, cant read file header
body: <p>I want to download files from folder that is protected for normal visit by .htaccess.
  I found many tutorials but none is working for me.</p>
  
  <p>.htaccess </p>
  
  <pre><code>&lt;files "passportScan.jpg"&gt;
    deny from all
  &lt;/files&gt;
  </code></pre>
  
  <p>php</p>
  
  <pre><code>$file_name = 'passportScan.jpg';
  $file_url = self::SERVER_URL . 'uploads/prom_conf/'.$user['uid'].'/' . $file_name;    
  header("Content-Description: File Transfer"); 
  header('Content-Type: image/jpeg');
  header("Content-disposition: attachment; filename=\"".$file_name."\"");
  readfile($file_url);
  </code></pre>
  
  <p>When I visit url /uploads/passportScan.jpg it is forbidden. That is correct. But when I call my php method it force download the file but then there is error "Can't read file header! Uknown file format or file not found!"</p>
  
  <p><strong>EDIT</strong>
  If I delete the htaccess it works fine.</p>
  
  <p><strong>EDIT 2</strong>
  Link is called from email.</p>