How to prevent a PDF file from direct URL Access in WordPress?

Solution:

If you want to deny access to all pdf files in the folder, try this in .htaccess:

# Deny access to files with extensions .pdf
<FilesMatch "\.(pdf)$">
Order allow,deny
Deny from all

</FilesMatch>