SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    .htaccess how to require authn for all files ina folder, besids certain file extentns

    .htaccess how to require authn for all files ina folder, besids certain file extentns

    .htaccess, how to require authentication for files in a folder, besides certian file extentions?

    hey guys, been trying this for about 24 hours now, and im just really beat..

    im using apache2, and i been to a couple sites such as the apache doc site, and no help at all(as in nothing i try works). What i want to do is, require authencation for all files in a directory execpt certain files with a particular extention, allowing all files but some extentions.

    so im attempting to add restriction for all files, and then trying to single out files with a particular extention and remove the require clause...not working though

    i have a folder with some jpgs in it, and some folders with other files, and also jpgs, i will be linking those jpgs from other sites, so i need then to not require authentication, however, all the other files in the doc root i need to set authentication for.

    this is what i have so far.

    <Directory /home/www/shared/>

    <Files *>
    AuthType Basic
    AuthName "This is a restriced site"
    AuthUserFile /pass/a
    AuthGroupFile /pass/g
    Require group GroupName
    </Files>


    #also tried saying overide none and placing the below in a .htaccess fle in the root dir
    <FilesMatch "\.jpg$">
    #<Files ~ "\.(jpg)$">
    #<Files *.jpg>
    Satisfy any
    #Require none #i dont think this call (none) even exists, but i still tried it.
    #Order deny,allow
    Allow from all
    #</Files>
    </FilesMatch>


    #some other config info here

    </Directory>

    can some please help me, or perhaps suggest a link, or a better solution to my problem

    thankx in advance.

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,644
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    px,

    First, WELCOME to SitePoint's Apache Forum!

    Unfortunately, your attempt at forbidding all access then punching holes won't work. Apache is a web server so only very rudimentary logic applies to its directives. You MUST create your FILES directive for specific files (with placeholders as required). I'm not sure whether it would work but, for a list of file extensions, I'd at least try *.(jpg|gif|png) to allow/block images.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    much thankx for your reply

    here is what i did...it seems to work as well, im not sure why it didnt work earlier, all i did was have a nap, and gave the server a kick.


    <FilesMatch "\.jpg$">
    Satisfy any
    Allow from all
    </FilesMatch>

    both .htaccess, and placing in <directory> seems to work.

    thankx once again for your reply...i was so terribly fustrated.

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,644
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    px,

    No problem. I know all too well that a bit of sleep can clear the head.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •