Your download.php
file is just setting some headers to tell the browser to download the file. It doesn’t actually write the content of the file in the response. You just have to add the following line of code to the end of download.php
:
readfile($_SERVER['DOCUMENT_ROOT'] . "/content/files/pdf2.pdf");
NOTE: As gview mentioned in the comments, the proper way to do this would be to move the files outside the document root so they cannot be accessed regardless of your per-directory htaccess file. You can still use my solution, but instead of using $_SERVER['DOCUMENT_ROOT']
, you would put the server path. Like this:
readfile("/server/path/to/content/files/pdf2.pdf");
5
solved How to hide files in a website