gnil
gnil

Reputation: 193

.htaccess file ineffective at password protecting my xampp directory?

I'm totally new to XAMPP and I'm trying to set up the security for it as best as possible. I understand that it is beneficial to create an .htaccess file to password protect certain directories. There is a page/script that is built into xampp available at http://localhost/security/xamppsecurity.php that will generate one for you in the /htdocs/xampp directory. However, after I've gone and done this, I'm still not prompted for a password when I visit my site at http://localhost/xampp. I thought I should've been prompted for a username and password here? This is a difficult problem to search answers for so I apologize if this has been answered already.

I've made sure to close/re-open my browser and delete all history/cache/cookies. I also restarted the Apache service after creating the htaccess file.

the .htaccess file:

AuthName "xampp user"
AuthType Basic
AuthUserFile "C:\xampp\security\xampp.users"
require valid-user

C:\xampp\security\xampp.users is a valid file and it contains the username I setup and an encrypted password.

Upvotes: 1

Views: 2192

Answers (1)

Vergilfox
Vergilfox

Reputation: 11

Try to copy your .htaccess file to the htdocs directory:

C:\xampp\htdocs\.htaccess

I hope it works ;)

Looks like .htaccess doesn't work on the htdocs\xampp directory.

Upvotes: 1

Related Questions