I have several files in a directory that require different types of authentication. For authentication we use cosign which means we have to define the user groups or users that have access to a directory in an .htaccess file. Is there a way that in my PHP code I can define different rules? I need to set a rule like Require user bjensen
. If not, is there a way in the .htaccess file that I can set certain parameters globally to all the pages and then specify rules for individual pages?
views:
23answers:
1
A:
I think what you're looking for are application variables. I'm not sure how to answer the first part of your question, but "is there a way in the .htaccess file that I can set certain parameters..." can be done with SetEnv.
For example, in your .htaccess file for a particular directory you could specify that it has accesss to a certain security group by
SetEnv SECURITY_GROUP alpha
Then, in your PHP file, use
apache_getenv('SECURITY_GROUP')
and only show content if your user is in the "alpha" group. Does that get you closer to what you want?
jnunn
2010-08-08 19:23:45
Unfortunately that isn't quite what I was looking for. What I mean by setting certain parameters was defining certain rules that would apply to all the files in the directory like a normal htaccess and then have additional rules in the same htaccess file that were limited to specified files. Thanks for trying to help though.
blcArmadillo
2010-08-10 14:54:15