 <p>Here are some guide-lines you may consider:</p> <ol> <li><p>Don't put direct link of files such as:</p> <pre><code>&lt;a href="mydoc.pdf"&gt;Download&lt;/a&gt; </code></pre></li> </ol> <p>Instead, try to generate your pdf dynamically or put a another encrypted medium for downloading eg:</p> <pre><code>&lt;a href="download.php?file_id=1111111"&gt;Download&lt;/a&gt; </code></pre> <p>2: Don't allow directory browsing, use htaccess file with following commands:</p> <pre><code> Deny from ALL </code></pre> <p>3: Not sure, but you may possibly allow file opening this way too:</p> <pre><code>$filename="/path/to/file.jpg"; //&lt;-- specify the image file if(file_exists($filename)){ header('Content-Length: '.filesize($filename])); //&lt;-- sends filesize header header('Content-Type: image/jpg'); //&lt;-- send mime-type header header('Content-Disposition: inline; filename="'.$filename.'";'); //&lt;-- sends filename header readfile($filename); //&lt;--reads and outputs the file onto the output buffer exit; //and exit } </code></pre> <p><strong>Note:</strong> above is just an example of image not pdf but you can modify it for your needs.</p>