I have a site that is powered by WordPress. I've created a section for members only, but I also want to have member only downloads. Most plugins offer more than I need, so I would like to see if I can protect my downloads without a plugin but with custom code.

How can I protect a directory where I have my member only downloads so it can only be accessed by a direct link when a user is logged in?

Can this be done with an .htaccess redirect?

Sorry if the above does not make sense.