Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Conditionally Setting .htaccess using mod_perl

by penguinfuz (Pilgrim)
on Aug 09, 2002 at 17:32 UTC ( [id://188978]=perlquestion: print w/replies, xml ) Need Help??

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.
  • Comment on Conditionally Setting .htaccess using mod_perl

Replies are listed 'Best First'.
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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://188978]
Approved by gryphon
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-24 19:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found