'Authentication with PHP 8.0-Password protecting files and folders with .htaccess and .htpasswd

I'm trying to password protect certain folders and files in my Apache directory. I place the .htaccess file in the folder and when I go to that directory, the browser asks for Authentication.

I tried creating a password from the command-line with the command, htpasswd -c .htpasswd client. The client username already exists in my .htpasswd file, but it doesn't prompt me to generate a new password.

My .htaccess file looks like this:

AuthUserFile C:/Apache24/htdocs/PHPandMySQL-2020/.htpasswd
AuthType Basic
AuthName "My Protected Folder"
Require valid-user

and my .htpasswd looks like this:

client: f.i9PC3.AtcXE

The authentication works on the folder. But when I go to the command-line, and type: htpasswd -c .htpasswd client. It doesn't prompt me to generate a new password.

Can anyone give me a hand here?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source