Password Protect A File

Discussion in 'Apache Migration/Compatibility' started by bambito, Sep 9, 2006.

  1. bambito

    bambito Member

    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.

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

    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, which shows the frontpage of the website. What am I doing wrong?

    "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

  2. xing

    xing LiteSpeed Staff

    I will answer the second part right now.

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

    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.
  3. bambito

    bambito Member

    Thanks! I don't know why I didn't see that earlier. I feel like a certified village idiot. :p

Share This Page