I've website running in apache 2.2.3. Root directory of website contains three directories. I want to setup authentication for these directories as below
only user1 can browse all pages
user2 can only access mydomain.com/dir1/
user3 can only access mydomain.com/dir2/
user4 can only access mydomain.com/dir3/
I've tried below configuration but only user1 can browse website other users are unable to access website.
<directory /var/www/html/example> AuthUserFile /etc/httpd/user1-htpasswd AuthName "Resricted" AuthType Basic Require user user1 </directory> <directory /var/www/html/example/dir1/> AuthUserFile /etc/httpd/user2-htpasswd AuthName "Resricted" AuthType Basic Require user user2 </directory> <directory /var/www/html/example/dir2/> AuthUserFile /etc/httpd/user3-htpasswd AuthName "Resricted" AuthType Basic Require user user3 </directory>
Please guide me for the same. Thanks in advance.