<IfModule mod_rewrite.c>
RewriteEngine On
# If a not logged in user tries to download a file it will redirect to home:
ErrorDocument 403 https://www.yoursite.com/
RewriteCond %{REQUEST_FILENAME} (.*)
# requires a cookie (wordpress login) for downloading media files
RewriteCond %{HTTP_COOKIE} !wordpress_logged_in_([a-zA-Z0-9_]*) [NC]
# Add more document extensions here.
# If you add image types (jpg,gif...) they woun't be shown to not logged users!
RewriteRule .(zip|doc|docx|pdf)$ – [NC,F,L]
</IfModule>