Password Protect A File

#1
I'm trying to password protect a file.

I tried it by .htaccess and by the admin interface in litespeed. No dice

If done by .htaccess, I get a 401 and no login box to authenticate to.

Example:
<Files admin.php>
AuthName "Restricted"
AuthType Basic
AuthUserFile /home/usernamedirectory/.staccess
Require valid-user
</Files>

If I use Auth Realm and Context for that specific vhost, authentication works. But instead of directing me to the admin.php file, it directs me to http://site.com/admin.php/, which shows the frontpage of the website. What am I doing wrong?

Example:
"Vhost Security Option Tab"
Realm Name Restricted
User DB Location /home/usernamedirectory/.staccess
User DB Max Cache Size N/A
User DB Cache Timeout (secs) N/A
Group DB Location N/A
Group DB Max Cache Size N/A
Group DB Cache Timeout (secs) N/A

"Vhost Context Option Tab"
URI /admin.php
Location /home/usernamedirectory/public_html
Accessible Yes
Enable Expires N/A
Expires Default N/A
Expires By Type N/A
Extra Headers N/A
MIME Type N/A
Force MIME Type N/A
Default MIME Type N/A
Index Files N/A
Auto Index N/A
Allow Override N/A
Realm Restricted
Authentication Name N/A
Required user user1, user2, user3, etc.
Access Allowed N/A
Access Denied N/A
Authorizer N/A
Add Default Charset Off
Customized Default Charset N/A
Enable Rewrite N/A
Rewrite Inherit N/A
Rewrite Base N/A
Rewrite Rules N/A
Apache Style configurations N/A

Thanks!
 

xing

LiteSpeed Staff
#2
I will answer the second part right now.

Code:
URI /admin.php
Location /home/usernamedirectory/public_html
should be:

Code:
URI /admin.php
Location /home/usernamedirectory/public_html/admin.php
Initially you have /admin.php the uri bound to the root www directory of your site which explains why you are getting the homepage. URI is the matching field and Location is the path of the content URI points to.
 
Top