Password protect specific folders in XAMPP

Scenario : XAMPP is installed in Windows Environment. You want to protect some folders with password. While some other folders you want to keep open to public.


There are two files that you need to create for this to work.


Step 1 : Create .htpasswd

Step 2: Create .htaccess file

AuthName “Protected Area”

AuthType Basic

AuthUserFile C:/xampp/apache/bin/.htpasswd

require valid-user

Save this file as .htaccess

Now please copy and paste this file whichever folders you wish to protect.

Now whenever you open the protected folder using browser you will be asked to enter password as follows.

Haneef Puttur

#There are TWO basic Rules for success. “Never Tell Everything You Know” and “Never Tell You Know Everything”