Step 1: Install package: sudo aptitude install apache2-utils
Step 2: Create a htpasswd file and register users in it:
a) For first user – user1: htpasswd -c /home/faraz/.htpasswd user1
b) For second user – user2: htpasswd /home/faraz/.htpasswd user2
Step 3: Make the following entry in the /etc/apache2/apache2.conf
for the URL: http://myserver/index.php/en/downloads/category/my-files, the entry should be:
AllowOverride None
AuthType basic
AuthName “private”
AuthUserFile “/home/faraz/.htpasswd”
Require valid-user
Step 4: Restart apache: sudo service apache2 restart
Note: This will match the following URLs as well:
http://myserver/index.php/en/downloads/category/my-files?a=1
http://myserver/index.php/en/downloads/category/my-files?b=2&c=3
Good One
Thank you 🙂