/    Sign up×
Community /Pin to ProfileBookmark

.htaccess not working? (Gives 500 error with correct info)

I want to restrict access to a certain folder on my server (file uploads) using .htaccess. I have a windows server configured with XAMPP. In the upload folder, I added .htaccess, .htpasswd and htpasswd.exe (local server).

My .htaccess file looks like this:
AuthUserFile /.htpasswd
AuthName “Restricted Access Area”
AuthType Basic
require valid-user

And the htpasswd has one user and is in the same directory. Indexing is enabled. When I browse to the location of the folder, its not there, hidden. If I type in the exact address in the address bar, the username and password prompt come up. I type in the username and password that I added to the .htpasswd fike and it gives me a 500 server error. It doesn’t say anything in the access and error log.

to post a comment
Full-stack Developer

6 Comments(s)

Copy linkTweet thisAlerts:
@bathurst_guyJul 14.2008 — You encrypted the password didn't you?
Copy linkTweet thisAlerts:
@njvenauthorJul 19.2008 — Yes, the password file is encrypted!
Copy linkTweet thisAlerts:
@bathurst_guyJul 19.2008 — The password file? No the pass[U]word[/U] inside the .htpasswd file needs to be encrypted, it can't just be typed in as you want it.
Copy linkTweet thisAlerts:
@Mr__E__CrypticJul 19.2008 — this page has a utility for encrypting the passwords for .htpasswd

eg: user: user1 with password: abc123

should be in the htpasswd file as:

user1:YW2tKnkPgw5Po
Copy linkTweet thisAlerts:
@njvenauthorJul 19.2008 — The stupid password is encrypted. I used htpasswd.exe that came with Apache distribution. I'm positive that the problems not with the .htpasswd file. It's either a problem in httpd.conf or in the .htaccess file.
Copy linkTweet thisAlerts:
@ray326Jul 19.2008 — AuthUserFile .htpasswd
×

Success!

Help @njven spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...