penguinfuz has asked for the wisdom of the Perl Monks concerning the following question:
Using mod_perl, I need to conditionally set the Apache "AccessFileName" directive.
The reasoning is that I am doing basic authentication and have user information located in two different .htpasswd files. To read both htpasswd files, I need two different .htaccess files in the same location to specify the appropriate .htpasswd. I know there are _much_ better solutions, but due to reasonings beyond my control, I must work with the current configuration.
Basically, when visiting a page (the gateway to the protected area), if you click "Lucy", AccessFileName is set to .htaccess-LUCY, but if you click "Ricky", AccessFileName is set to .htaccess-RICKY, but both go to the same location. I have no trouble getting this information, but actually making the change the Apache configuration is what's stumping me.
I am currently reading about PerlAccessHandlers, but have yet to see exactly how this is going to work... Closest thing I can think of is using something like PerlSetVar. I would greatly appreciate anyone pointing me in the right direction.
Re: Conditionally Setting .htaccess using mod_perl
by twerq (Deacon) on Aug 09, 2002 at 17:46 UTC
|
You're on the right track with PerlAccessHandlers -- if you have the luxury of mod_perl, you can easily whip up a replacement auth handler that can read and auth against your two password files, or a database, or whatever you like.
this site is probably your best bet for learning how to do what you want under mod_perl/apache 1.x
--twerq | [reply] |
|