0

I have the following problem, I have users in my database with wordpress encrypted passwords. There are pdf files I do not want all of them to access so I am going to use htaccess and htpasswd files. The problem is when I copy their passwords to the htpasswd it does not work, what should I do? Do I just give them new passwords for the pdf files? How do I write my htpasswd file so that it can understand the wordpress encrypted passwords?

This is what I have and forgive me if I am doing it completely wrong, I am new programming:

AuthType Digest
AuthUserFile ........./www/.htpasswd 
AuthName "Restricted"
<Files file1.pdf>Require user john </Files>

In the .htpasswd I have

John:$P$BiJ2okZmr880S2Ow.XBQkovjx4XCG00
daw dasf
  • 35
  • 6

1 Answers1

1

The WordPress database will encrypt the password so the .htaccess will not match unless the customer provides you the unencrypted password, but if it changes the .htaccess will have to be updated. This will require alot of work on your part.

The best solution is to allow the WordPress installation to manage the access control to the downloads so there is no outside management and the user's passwords can be updated. This is the great thing about WordPress because generally if you need your WordPress to do something there is a free plugin available for it.

The one here may meet your needs, and there are alot more available via WordPress.org which can be accessed directly within your Admin panel's plugin section for easy installation.

Hope this helps.

MattSizzle
  • 3,145
  • 1
  • 22
  • 42