How to allow download url redirection only if user logged in WordPress site?

An htaccess rule is evaluated before WP is called to get page content. So there is no variable you could use in an htaccess rule to check if a user is logged in.

Instead, I’d add to your functions.php file code that would check the is_user_logged_in() result. If not logged in, then use wp_redirect() to redirect to a login page. The die() is important after the wp_redirect so that the redirect will work properly.

Code would look something like this (not tested):

function check_user_logged_in() {
if (! is_user_logged_in()) {
   // not logged in, so redirect them
   wp_redirect("https://www.example.com/login-page");
   die();
   }
return;}
add_filter("init", "check_user_logged_in"); // fires the function on WP init

Of course, this should be placed in your Child Theme’s functions.php file.

Added 20 Jul 2020

Corrected the code fragment to be is_user_logged_in – which I did speify correctly in the non-code portion of the answer. Thanks to @Frits for his eagle eye. (I did say it was untested code, so maybe that’s my excuse….)