Forum Moderators: phranque
Here is the directory structure
www.example.com/directoryA/directoryB/
directoryA contains all the admin files and needs to be password protected. I have successfully done this using .htaccess.
directoryB contains the files that need to be accessible by the public.
I created a new .htaccess file for directoryB and put this in it:
order allow
allow from all
Would anybody have an idea on how to allow access to directoryB while restrict access to directoryA?
Thank you again.
RewriteCond %{REQUEST_URI} !^/directoryB/
RewriteCond %{REQUEST_URI} ^/directoryA/
< rules for password auth >
Something like that.
Wiz
I can not move directoryB out of directoryA as I was informed that this would break the programme.
There are a total of 10 sub directories in directoryA and of those I only want directoryB accessible to the public and the rest restricted. Would the “rewrite condition and rule” you suggest be able to do this or would the other 9 directories all become accessible to the public as well?
Thank you again.
SetEnvIf Request_URI ^/directoryA/directoryB nopasswd
#
# ... your existing password setup code
#
Require valid-user
#
Satisfy any
Allow from nopasswd
Jim
SetEnvIf Request_URI ^/directoryA/directoryB nopasswd
#
AuthType Basic
AuthUserFile /path/to/diectoryA/.htpasswd
AuthName "Members Area"
require valid-user
#
Require valid-user
#
Satisfy any
Allow from nopasswd
I uploaded this into directoryA and now the full folder and all the subfolders are publicly accessible.
Would you please point out what I have done wrong?
Thank you for your help
Sorry, using Satisfy [httpd.apache.org] is a bit complex, but once you understand it, your goal should be achievable.
Jim