.htaccess how to require authn for all files ina folder, be

Alles, was den Apache betrifft, kann hier besprochen werden.

.htaccess how to require authn for all files ina folder, be

Postby pxshock » 28. April 2008 00:50

im sorry, i only speak english.

.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

#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

#some other config info here


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

thankx in advance.
Posts: 1
Joined: 18. November 2007 07:43

Postby Xardas der Dunkle » 28. April 2008 06:55

I don't think that this will work.
You can only make a Authification for the Directory but not for the files.

You could save the files in two different folders. One for the allowed files and one for the others.

Or you block the whole call of the files and says:
Code: Select all
<FilesMatch "\.jpg$">
   Deny from all

btw. you don't need to write this: <Directory /home/www/shared/> in .htaccess-Files if the directory are the same as the directory where the .htaccess lay.[/code]
User avatar
Xardas der Dunkle
Posts: 482
Joined: 09. March 2008 19:40
Location: /var/www

Return to Apache

Who is online

Users browsing this forum: No registered users and 5 guests