Password Protecting Wordpress Uploads

software development

#1

Hi,

I need to password protect a range of files that will be managed by the Wordpress uploader. I don’t know exactly where the file will be within the uploads folder, and I don’t know in advance the exact filename.

I think .htaccess will suit my needs, though I’m open to alternative suggestions. My main consideration is that the end user not have to do anything technical or difficult to protect the uploaded file.

I’ve tried the following:

____ code _____

<FilesMatch “private.*$”>
AuthName "Private File"
AuthType Basic
AuthUserFile /mydomain.com/.htpasswd
require valid-user

____ end code _____

You can see I’m attempting to password protect any file that has the word private in the name. This isn’t working though, and the file “http://www.mydomain.com/wp/wp-content/uploads/2009/11/private_mydoc.docx” is still able to be downloaded without a password.

Any suggestions on how I can better manage this?