Virus721
Virus721

Reputation: 8315

WAMP Server 2.2 - .htaccess -> Internal error (500)

I've just added an .htaccess and an .htpasswd to my web app and i'm now getting an error 500.

.htaccess :

AuthUserFile ./.htpasswd
AuthName "Password Protected Area"
AuthType Basic

<limit GET POST>
require valid-user
</limit>

.htpasswd

root:roe7nCYHcm0As

I've read on this web site that i had to enable "headers_module" and "rewrite_module" and then retart the server, which i did, but i'm still getting this error.

I'm using wampserver 2.2 (apache 2.4.2) on windows 7.

Upvotes: 0

Views: 1859

Answers (2)

RiggsFolly
RiggsFolly

Reputation: 94642

Actually it could well be that you have installed wamp into 'program files'

There are a few bits of Apache and PHP that dont like living in a folder structure that has a space in one of the folder names.

It is recommended that you install it to C:\wamp or D:\wamp or any drive you like but not one with a space in any folder name.

Upvotes: 0

Savas Vedova
Savas Vedova

Reputation: 5692

That's most probably because htaccess does not find your file's location.

If you use a relative path, then apache uses the server root which is /etc/apache2 in my case (ubuntu).

Just to be sure, click right on the password file and get the path and paste it to .htaccess. If it still not works, please copy and paste your error log here so that I can exactly see the error.

EDIT

I've seen your last comment now.

Some setups require that you store the encrypted version of the password. So for instance, instead of storing the password as

myuser:111

you should store like:

myuser:$apr1$E6YrxcHU$ilyC2mqfNSrQmle4KEAeq.

I don't have a Windows at hand right now so I cannot check it but earlier versions of Wamp had a password generator for .htpasswd under c:\wamp\Apache2\bin\htpasswd.exe. Try to check that program.

Otherwise, apache uses md5 by default to encrypt passwords. You can encrypt programmatically your password and then copy it to the password file.

I even blogged about this :)

Please let me know if it still doesn't work.

Upvotes: 1

Related Questions