Forum Moderators: phranque

Message Too Old, No Replies

Variables in htaccess file

Variables in htaccess file

         

Lucv

8:58 pm on Jan 8, 2005 (gmt 0)

10+ Year Member



Hello,
I'm using perl authentication in a .htaccess file.
I have different types of users, say U1, U2 and U3.
Access to directories should be restricted to one or more type of users.
I'd like to put something in the .htaccess file that specifies which usertypes have access to this directory.
Is it possible to set a variable in a .htaccess file and how can I reach the value from within my authentication scripts?
Or do you know another solution?
Many thanks,
Luc.

jdMorgan

12:14 am on Jan 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Lucv,

Welcome to WebmasterWorld!

SetEnvIf in mod_setenvif and RewriteRule in mod_rewrite can both be used to set variables.

Jim

Lucv

5:13 pm on Jan 11, 2005 (gmt 0)

10+ Year Member



I found out how to achieve what I want.

I check in authen_cred (I'm using Apache::AuthCookie) for the existance of my authorisation cookie and check userid and password.
(I'm using $r->subprocess_env(...) to pass information back to my login form).

my authen_ses_key method just returns the $cookie_value.

I use the require group directive to check if the user is authorized to view the page.
I implemented the group method in which I verify if the user belongs to the required group.

Luc.