Blocking Access to PDF Uploads

WordPress

Add this to the .htaccess file in the WordPress Uploads directory to block PDF access to non logged-in users.

RewriteCond %{REQUEST_FILENAME} (.pdf)
RewriteCond %{HTTP_COOKIE} !wordpress_logged_in_([a-zA-Z0-9_]*) [NC]
RewriteRule .* - [F,L]

Leave a Reply

Your email address will not be published. Required fields are marked *