logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: .htaccess how to require authn for all files ina folder, ece
Author
pxshock



Joined: 28 Apr 2008
Posts: 1

PostPosted: Mon 28 Apr '08 1:18    Post subject: .htaccess how to require authn for all files ina folder, ece Reply with quote

.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..Sad

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 Sad

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.
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Mon 28 Apr '08 16:27    Post subject: Reply with quote

I think your problem may be that your image files match both of your <Files> directives.
In this case, it is the first one that they match (the <Files *> directive) which counts.

Perhaps you want this:
Code:
<Directory /home/www/shared/>
    AuthType Basic
    AuthName "This is a restriced site"
    AuthUserFile /pass/a
    AuthGroupFile /pass/g

    Allow from all
    Require group GroupName
    Satisfy all
    <Files *.jpg>
        Satisfy any
    </Files>
</Directory>
with authentication on the whole directory, and .jpg files as exceptions.

-tom-
Back to top


Reply to topic   Topic: .htaccess how to require authn for all files ina folder, ece View previous topic :: View next topic
Post new topic   Forum Index -> Apache