in reply to Parsing/validating Apache .htaccess file
You can have a htaccess.tpl and then process it using some templating toolkit of your choice, like Template-Toolkit. It is easier to mantain this way IMHO.
Example:Hope this helps.use strict; use warnings; use Template; my $template = Template->new(); my $vars = { ips_to_block => [qw/10.10.10.1 10.10.11.1/], }; my $output = ''; $template->process(\*DATA, $vars, \$output) or die $template->error(); print $output; __DATA__ AuthUserFile /var/apache/htpasswd AuthGroupFile /var/apache/htgroup AuthName "My Realm" AuthType Basic order allow,deny allow from all [% FOREACH ip_to_block = ips_to_block %] deny from [% ip_to_block %] [% END %]
Update:Removed <Limit> tags. Thanks merlyn!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
On Limiting Limits
by merlyn (Sage) on Aug 09, 2005 at 14:43 UTC |