FilesMatch Usage Question

Discussion in 'Apache' started by gw1500se, Mar 18, 2011.

  1. #1
    I have a directory of files that require a login to access (AuthMySQL). That all works except there are 3 files that I want to allow without login. I am guessing the way to accomplish this is with FilesMatch. However, I can't seem to come with a working structure. Does this directive go inside the <Directory> block or does the <Directory> block go inside <FilesMatch>? TIA.
     
    gw1500se, Mar 18, 2011 IP
  2. gw1500se

    gw1500se Member

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #2
    After playing with this a lot, I may or may not be making progress but I am getting something with <FilesMatch> inside <Directory>. However, what I am getting is odd. Here is my config for that directory:
    
    <Directory "/var/www/html/cufs">
                            AuthName "CUFS Alumni"
                            AuthType Basic
                            AuthMySQLUser uuuuuuuuu
                            AuthMySQLPassword ppppppppp
                            AuthMySQLEnable on
                            AuthMySQLPwEncryption scrambled
                            AuthMySQLDB cufsalumni
                            AuthMySQLUserTable alumni
                            AuthMySQLNameField username
                            AuthMySQLPasswordField pwdp
                    <FilesMatch "^(?!index\.html$|cufsregister\.php$)">
                            require valid-user
                    </FilesMatch>
            </Directory>
    
    Code (markup):
    What is happening, is if I do not specify index.html in the URL (just specify the directory) it prompts for the log in. If I then cancel the prompt, the 401 error is displayed. However, if I put index.html into the URL and click the log in link, there is no prompt and all the pages are available with no login. Does this make sense to anyone?
     
    gw1500se, Mar 18, 2011 IP
  3. smellocity

    smellocity Active Member

    Messages:
    155
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    88