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:
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 %]
Hope this helps.
Update:Removed <Limit> tags. Thanks merlyn!
Igor S. Lopes - izut
surrender to perl. your code, your rules.
|