2

How could I give different access to sub-directories?

The first problem is: I must let the programmers modify the htaccess files, but not the access control.

I have access only to htaccess directives for once, not to the httpd.conf of Apache. And here are my folders:

~/www/ ~/beta/ -> group betatesters developers ~/dev/ -> group developers 

I would like to have only one .htaccess located in the root directory (developers don't have access there).

~/.htaccess ~/htpassd ~/htgroup 

.

AuthType Basic AuthName "Password Required" AuthUserFile /home123/user321/htpasswd AuthGroupFile /home123/user321/htgroup <FilesMatch "beta"> Require group betatesters developers </FilesMatch> <FilesMatch "dev"> Require group developers </FilesMatch> 

Any idea?

2 Answers 2

1

You can set in the Apache conf what parameters are fair game to be changed in a .htaccess file. http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride

In your specific example, you don't want the AuthConfig settings to be overidable. You can do that either by not listing AuthConfig with the AllowOveride directive. eg.

<Directory foo> AllowOveride Indexes <...> </Directory> 

Or explicitly declaring that AuthConfig is not modifiable.

<Directory foo> AllowOveride -AuthConfig <other options here> </Directory> 
1
  • it's not that I don't want Authconfig to be overidable or not, it's that I want a different one for each. And in a perfect world it would not be in .htacces in each directory itself Commented Sep 14, 2011 at 16:01
1

after you stated you DON'T have access to httpd.conf, Joshua Hoblitt answer only applies partially.

if it is possible for you to use another directory structure like

~/www ~/www/beta ~/www/dev 

you could adapt Joshua's solution.

2
  • I don't understand how I could have the equivalent of a <Directory> for each... directory. Since my goal is to have different rules for each one. Commented Sep 14, 2011 at 15:26
  • sorry i missunderstood Commented Sep 14, 2011 at 20:38

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.