Htaccess rule for restrict not logged in user(cookie based) to access direct pdf link in Wordpress. I have tried the rules to restrict access on local host it worked partially on it but when applied on the live website rules not seems to work. The code i have tried mentioned below.
RewriteCond %{REQUEST_URI} \.(pdf)$ [NC]
RewriteCond %{HTTP_COOKIE} !^.*cookie_name.*$
RewriteRule . https://%{HTTP_HOST}%1/contact-sales/ [L,QSA]