accessing secure folder gets me redirected without prompting password

Discussion in 'Apache' started by dvlad, Jan 27, 2012.

  1. #1
    Hello,

    I know only very few basic things about apache configuration.

    I have a website that is made to redirect everything to the index.php file, except a few folders.

    What I want to add is a folder that will be password secured.

    So in the public_html folder i already have the following .htaccess file:

    <Limit GET POST>
    order deny,allow
    deny from all
    allow from all
    </Limit>
    <Limit PUT DELETE>
    allow from all
    </Limit>

    RewriteEngine on

    RewriteCond $1 !^(index\.php|images|css|scripts|system|uploads|robots\.txt|styles\.css|site|docs|admin|validate|ep3gate\.class\.php)

    RewriteRule ^(.*)$ ./index.php/$1 [L]



    And in the folder "docs" that I want to protect i added the following .htaccess file:


    AuthUserFile /pswd/.htpasswd
    AuthName "Secured files, enter password"
    AuthType Basic
    require valid-user



    What happens is that before I added the .htaccess file to the 'docs' folder I could access the files inside, after I added the .htaccess file it gets me redirected to the index.php file without asking me for any password.

    What else should i do?

    Thank you very much for your help!

    Vlad.
     
    dvlad, Jan 27, 2012 IP
  2. SolidShellSecurity

    SolidShellSecurity Banned

    Messages:
    262
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    45
    #2
    Put the auth before the redirect and make sure you have the encrypted password string in the .htpasswd file.
     
    SolidShellSecurity, Jan 27, 2012 IP
  3. dvlad

    dvlad Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks for the answer, but there are two separate files. The first one with the redirect in placed in the root (public_html) folder. The other one containing the auth is placed in the sub-folder (docs).
     
    dvlad, Jan 27, 2012 IP