htaccess not working

dlhhyct

Active Member
#1
when enabled htaccess in one html page vhost, browser fails to authenticate and continue to prompt for password.

Code:
AuthType Basic
AuthName "secret"
AuthUserFile /data/apps/maint/.htpasswd
Require user admin
passwd file created by "htpasswd2 -c .htpasswd admin"
error log: [127.0.0.1:42960-0#maint] Authentication failed with user: 'admin'.
lsws: std 2.2.2 upgraded from previous version.

I remember htaccess on previous lsws worked, forgot which version.
 

dlhhyct

Active Member
#3
still not working

i first generate password using "htpasswd2 .htpasswd admin", enter actual password "password", and generated .htpasswd file contains "admin:plGpWI7RquZKQ"

then I use perl to generate again, result from perl matches .htpasswd, so password is ok.
Code:
#!/usr/bin/perl
$val = crypt("password", "Pl");
print "result: $val\n";
and I blasted away old lsws, did a fresh install of std 2.2.2, still can't login.
 

dlhhyct

Active Member
#5
:(

i think my path and permission are correct:
PHP:
ws maint # pwd
/data/apps/maint
ws maint # 
ws maint # ls -al
total 16
drwxr-xr-x 2 dchen  users  168 2006-10-05 10:11 .
drwxr-xr-x 6 dchen  users  152 2006-10-04 22:04 ..
-rwxr-xr-x 1 dchen  users   72 2006-10-05 00:38 gen.pl
-rw-r--r-- 1 nobody nobody  92 2006-10-05 10:01 .htaccess
-rw-r--r-- 1 nobody nobody  20 2006-10-05 09:58 .htpasswd
-rw-r--r-- 1 dchen  users   12 2006-10-04 22:04 index.html
ws maint # 
ws maint # cat .htaccess 
AuthType Basic
AuthName "secret"
AuthUserFile /data/apps/maint/.htpasswd
Require user admin
ws maint # 
ws maint # cat .htpasswd 
admin:vEuwSmbabnxKM
 

dlhhyct

Active Member
#7
realm works

i setup realm1, setup static context "/r1" -> $VH_ROOT using realm1, browser pops up login box for realm1, and it works.

so should i use realm instead of htaccess for such? what's the difference of 2?

what I try to do is for ruby on rails app, I deploys same code to 2 vhosts. 1st vhost for public users with "/admin" disabled, and 2nd admin vhost with htaccess.
 

mistwang

LiteSpeed Staff
#8
This two should have the same result, but I am not sure why htacess does not work well on your case.

If you can avoid using .htaccess, you should avoid it.
 
Top