Htaccess + htpasswd question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Lace
    Too lazy to set a custom title
    • Mar 2004
    • 16116

    #1

    Htaccess + htpasswd question

    Need to use htaccess and htpasswd to protect all pages besides index.html along with all images used outside of the index.

    Here's what I have so far, but it's pw protecting the index.html as well.

    Code:
    AuthName "Site Name" 
    AuthType Basic 
    AuthUserFile /path_to_/.htpasswd
    Require valid-user
    
    <Files "*">
    Require valid-user
    </Files>
    
    <FilesMatch "(index\.html|logo\.png)$">
    Allow from all
    Satisfy any
    </FilesMatch>
    Your Paysite Partner
    Strength In Numbers!
    StickyDollars | RadicalCash | KennysPennies | HomegrownCash
  • bl4h
    Confirmed User
    • Jul 2006
    • 1282

    #2
    not sure but I can almost guarantee that whatever youre doing, youre doing it the hard way

    Comment

    • Lace
      Too lazy to set a custom title
      • Mar 2004
      • 16116

      #3
      Originally posted by bl4h
      not sure but I can almost guarantee that whatever youre doing, youre doing it the hard way
      Well, yeah. I could set it up in a folder, but I'd rather not have to move everything.
      Your Paysite Partner
      Strength In Numbers!
      StickyDollars | RadicalCash | KennysPennies | HomegrownCash

      Comment

      • TisMe
        Confirmed User
        • Aug 2008
        • 1719

        #4
        No expert but I think you need an ignore index line.

        Something like this:

        Code:
        IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

        Comment

        • Paz
          Confirmed User
          • Jun 2012
          • 457

          #5
          Gottit working on my server in a folder www.carlparry.com/gfy/

          # Set exception for /gfy/index.html and set as variable AdminUri for use later
          SetEnvIf Request_URI "^/gfy/index.*$" AdminUri

          # Setup the password protection (standard folder protect)
          AuthUserFile /home/xxxxxxxxxx/carlparry.com/gfy/.htpasswd
          AuthName "GFY - folder protected"
          AuthType Basic
          AuthUserFile ./.htpasswd
          Require valid-user

          # Now add the exceptions for matched URL's index.html (not standard)
          Order Deny,Allow
          Deny from all
          Allow from env=AdminUri
          Satisfy any
          Cheers,
          Paz.

          Comment

          • KaliC
            Sexy Beast
            • Jan 2005
            • 617

            #6
            Originally posted by Lace
            Well, yeah. I could set it up in a folder, but I'd rather not have to move everything.
            Yeah, it's best to keep the htaccess files and folders in a separate protected folder.
            AdultWebHosting.com

            Comment

            Working...