i want to know how to have access some files in special directory which is need to be authenticate with apache web server this is my config file
<Directory /var/www/media>
Order deny,allow
AuthType Basic
AuthName "Restricted Files"
AuthUserFile htpasswd
Require user ABC
Options +Indexes
</Directory>
inside the media folder i have folder named temp and inside temp there are some pdf files i want to access them without entering password or access from url like this "www.example.com/media/temp/abc.pdf"
Inside /var/www/media/temp/.htaccess
have these 2 lines:
Satisfy Any
Allow from all
This will disable Basic Auth
for whole /var/www/media/temp/
directory and all files under it. However if you want to disable only for /var/www/media/temp/*.pdf
files then you need more code using mod_setenvif
as this:
SetEnvIfNoCase Request_URI \.pdf$ NO_AUTH
Satisfy any
Order deny,allow
Deny from all
Allow from env=NO_AUTH