I have created a folder(ABC) inside the wp-content/uploads directory of my WordPress website where I am storing pdf files that are basically creating automatically at some trigger by the user. I'm trying to restrict the direct access of that pdf files i.e. pdf can only be accessible by the owner of that particular pdf when he/she is logged in.
I found the solution here: https://stackoverflow.com/a/35548138/12484098, But my only question is how should I manage the .htaccess file in my case or how can I add the correct path for RewriteCond so that the system knows where the pdf files are stored?
.htaccess
RewriteEngine On
RewriteCond ^(.*)$ /wp-content/uploads/ABC/ %{REQUEST_FILENAME} ^.*(pdf)$ // tried to change this line
RewriteRule ^(.*)$ /wp-content/download.php?file=$1 [L]
Thanks!