I have to restrict direct downloading any file inside the directory in the webserver. Also, should allow to download through server script generated encrypted URL.
For example,
Directory path of the file: /home/downloads/password.txt
URL: http://www.sitename.com/downloads/password.txt
Direct access to the URL must be restricted. But, should allow to download through server generated encrypted URL.
For example,
<a href="http://www.sitename.com/xxxxxxxxxxx.php">Download</a>
The actual server script to control downloads will be,
http://www.sitename.com/private/download.php
But, direct access to that URL (shown above) should be restricted. So, that there will be no permanent link to access directly.